Skip to content

Commit ec981b3

Browse files
committed
Fix Docker build errors and improve build speed
- Remove non-existent config/production.toml references from Dockerfile - Remove /etc/qnet directory creation and config path variables - Change LTO from 'true' to 'thin' for faster compilation - Add release-fast profile for development builds (no LTO, 16 codegen-units) - Update Docker build to use release-fast profile for speed - Fix COPY command paths and startup command arguments
1 parent dca1a76 commit ec981b3

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

development/qnet-integration/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,13 @@ name = "qnet-node"
110110
path = "src/bin/qnet-node.rs"
111111

112112
[profile.release]
113-
lto = true
113+
lto = "thin"
114114
codegen-units = 1
115115
panic = "abort"
116-
opt-level = 3
116+
opt-level = 3
117+
118+
[profile.release-fast]
119+
inherits = "release"
120+
lto = false
121+
codegen-units = 16
122+
opt-level = 2

development/qnet-integration/Dockerfile.production

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ COPY . .
2727
ENV RUSTFLAGS="-C target-cpu=native"
2828
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
2929

30-
RUN cargo build --release --bin qnet-node \
31-
&& strip target/release/qnet-node \
32-
&& cp target/release/qnet-node /usr/local/bin/
30+
RUN cargo build --profile release-fast --bin qnet-node \
31+
&& strip target/release-fast/qnet-node \
32+
&& cp target/release-fast/qnet-node /usr/local/bin/
3333

3434
# Production runtime image
3535
FROM debian:bookworm-slim
@@ -45,11 +45,10 @@ RUN apt-get update && apt-get install -y \
4545

4646
# Copy binary from builder
4747
COPY --from=builder /usr/local/bin/qnet-node /usr/local/bin/
48-
COPY --from=builder /build/config/production.toml /etc/qnet/config.toml
4948

5049
# Create necessary directories with proper permissions
51-
RUN mkdir -p /app/data /app/logs /etc/qnet \
52-
&& chown -R qnet:qnet /app /etc/qnet \
50+
RUN mkdir -p /app/data /app/logs \
51+
&& chown -R qnet:qnet /app \
5352
&& chmod 755 /app/data /app/logs
5453

5554
# Switch to non-root user
@@ -58,7 +57,6 @@ USER qnet
5857
# Set environment variables for production
5958
ENV RUST_LOG=info
6059
ENV RUST_BACKTRACE=1
61-
ENV QNET_CONFIG_PATH=/etc/qnet/config.toml
6260
ENV QNET_DATA_DIR=/app/data
6361
ENV QNET_LOG_DIR=/app/logs
6462

@@ -71,4 +69,4 @@ EXPOSE 8545 30303 9090
7169

7270
# Production startup command with proper signal handling
7371
ENTRYPOINT ["/usr/local/bin/qnet-node"]
74-
CMD ["--config", "/etc/qnet/config.toml", "--data-dir", "/app/data"]
72+
CMD ["--data-dir", "/app/data"]

0 commit comments

Comments
 (0)