Skip to content

Commit 6e5c7c8

Browse files
authored
Fix Payjoin directory docker build (payjoin#592)
Running into ``` => ERROR [builder 7/7] RUN cargo build --release --target x86_64-unknown-linux-musl 4.3s ------ > [builder 7/7] RUN cargo build --release --target x86_64-unknown-linux-musl: 0.228 Updating crates.io index 4.306 error: failed to select a version for `payjoin`. 4.306 ... required by package `payjoin-directory v0.0.1 (/usr/src/payjoin-directory)` 4.306 versions that meet the requirements `^0.22.0` are: 0.22.0 4.306 4.306 the package `payjoin-directory` depends on `payjoin`, with features: `directory` but `payjoin` does not have these features. 4.306 4.306 4.306 failed to select a version for `payjoin` which could resolve this conflict ``` Which can be resolved by building the directory from the workspace. In order to do that we need to copy the workspace manifest and all the source code. I introduced a dockerignore file to ignore build files and other non-source code files in the first commit Tested using: ```bash docker buildx build --no-cache -f payjoin-directory/Dockerfile . -t payjoin-directory:0.0.1-rc2 --load ```
2 parents e8cff01 + 8ef44a7 commit 6e5c7c8

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

.dockerignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Target directory (compiled binaries)
2+
target/
3+
4+
# Rust's incremental compilation and debug info
5+
**/incremental/
6+
**/debug/
7+
**/release/
8+
**/deps/
9+
**/examples/
10+
**/bench/
11+
12+
# Hidden system files
13+
.DS_Store
14+
Thumbs.db
15+
16+
# IDE & Editor settings
17+
.idea/
18+
.vscode/
19+
*.iml
20+
21+
# Logs and temporary files
22+
logs/
23+
*.log
24+
*.tmp
25+
*.swp
26+
*.swo
27+
*.swn
28+
29+
# Git files
30+
.git/
31+
.gitignore
32+
33+
# Docker files (optional)
34+
.dockerignore
35+
Dockerfile

payjoin-directory/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ ENV AR_x86_64_unknown_linux_musl=ar
2020
# Add the x86_64-unknown-linux-musl target
2121
RUN rustup target add x86_64-unknown-linux-musl
2222

23-
# Copy the manifest and source code
24-
COPY payjoin-directory/Cargo.toml ./
25-
COPY payjoin-directory/src/ ./src/
23+
# Copy the workspace manifest and source code
24+
COPY . .
2625

2726
# Build the binary
28-
RUN cargo build --release --target x86_64-unknown-linux-musl
27+
RUN cargo build --bin payjoin-directory --release --target x86_64-unknown-linux-musl
2928

3029
# Create final minimal image
3130
FROM --platform=linux/amd64 alpine:latest

0 commit comments

Comments
 (0)