Skip to content

Commit 092a3a6

Browse files
committed
more fixes
1 parent 9caa34b commit 092a3a6

File tree

2 files changed

+104
-21
lines changed

2 files changed

+104
-21
lines changed

.dockerignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Rust build artifacts
2+
target/
3+
**/*.rs.bk
4+
*.pdb
5+
6+
# Git
7+
.git/
8+
.gitignore
9+
10+
# IDE
11+
.idea/
12+
.vscode/
13+
*.swp
14+
*.swo
15+
*~
16+
17+
# OS
18+
.DS_Store
19+
Thumbs.db
20+
21+
# Documentation
22+
*.md
23+
!README.md
24+
!LICENSE-*
25+
26+
# Development files
27+
.env
28+
.env.local
29+
.env.*.local
30+
31+
# Test artifacts
32+
tarpaulin-report.html
33+
cobertura.xml
34+
35+
# Temporary files
36+
tmp/
37+
temp/
38+
*.tmp
39+
*.temp
40+
41+
# Docker
42+
.dockerignore
43+
Dockerfile*
44+
docker-compose*.yml
45+
46+
# CI/CD
47+
.github/
48+
.gitlab-ci.yml
49+
.travis.yml
50+
51+
# Benchmarks and profiling
52+
benches/
53+
perf.data
54+
perf.data.old
55+
flamegraph.svg

Dockerfile

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,60 @@
1-
# syntax=docker/dockerfile:1
1+
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
2+
WORKDIR /app
23

3-
# Build stage
4-
FROM rust:1.86-slim AS builder
4+
LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0"
55

6-
# Install build dependencies
7-
RUN apt-get update && apt-get install -y \
8-
pkg-config \
9-
libssl-dev \
10-
&& rm -rf /var/lib/apt/lists/*
6+
RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config
117

12-
WORKDIR /app
8+
FROM chef AS planner
9+
COPY . .
10+
RUN cargo chef prepare --recipe-path recipe.json
11+
12+
FROM chef AS builder
13+
COPY --from=planner /app/recipe.json recipe.json
1314

14-
# Copy manifests
15+
# Copy workspace Cargo files for better caching
1516
COPY Cargo.toml Cargo.lock ./
16-
COPY bin/ bin/
17-
COPY crates/ crates/
17+
COPY bin/lumen/Cargo.toml bin/lumen/
18+
COPY crates/common/Cargo.toml crates/common/
19+
COPY crates/node/Cargo.toml crates/node/
20+
COPY crates/rollkit/Cargo.toml crates/rollkit/
21+
COPY crates/tests/Cargo.toml crates/tests/
22+
23+
ARG BUILD_PROFILE=release
24+
ENV BUILD_PROFILE=$BUILD_PROFILE
25+
26+
ARG RUSTFLAGS=""
27+
ENV RUSTFLAGS="$RUSTFLAGS"
28+
29+
# Cook dependencies first (better layer caching)
30+
RUN cargo chef cook --profile $BUILD_PROFILE --recipe-path recipe.json --manifest-path bin/lumen/Cargo.toml
1831

19-
# Build the application
20-
RUN cargo build --release --bin lumen
32+
# Copy all source code
33+
COPY . .
2134

22-
# Runtime stage
23-
FROM gcr.io/distroless/cc-debian12
35+
# Build the binary
36+
RUN cargo build --profile $BUILD_PROFILE --bin lumen --manifest-path bin/lumen/Cargo.toml
37+
38+
# Copy binary from correct location
39+
RUN ls -la /app/target/$BUILD_PROFILE/lumen
40+
RUN cp /app/target/$BUILD_PROFILE/lumen /lumen
41+
42+
FROM ubuntu:22.04 AS runtime
43+
44+
RUN apt-get update && \
45+
apt-get install -y ca-certificates libssl-dev pkg-config strace && \
46+
rm -rf /var/lib/apt/lists/*
47+
48+
WORKDIR /app
49+
COPY --from=builder /lumen /usr/local/bin/
50+
RUN chmod +x /usr/local/bin/lumen
51+
COPY LICENSE-* ./
2452

25-
# Copy the binary from builder
26-
COPY --from=builder /app/target/release/lumen /usr/local/bin/lumen
53+
# Expose ports: P2P, Discovery, Metrics, JSON-RPC, WebSocket, GraphQL, Engine API
54+
EXPOSE 30303 30303/udp 9001 8545 8546 7545 8551
2755

28-
# Expose default ports
29-
EXPOSE 8545 8546 30303 6060 9001
56+
# Add health check
57+
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
58+
CMD /usr/local/bin/lumen --version || exit 1
3059

31-
# Set the entrypoint
3260
ENTRYPOINT ["/usr/local/bin/lumen"]

0 commit comments

Comments
 (0)