11# Build stage
2- FROM rust:alpine AS builder
2+ FROM rust:slim-bookworm AS builder
33
4- # Install musl-dev and build tools for static linking
5- RUN apk add --no-cache musl-dev build-base lld cmake
4+ # Install build tools plus the downloader dependencies used by the lbug crate.
5+ RUN apt-get update && apt-get install -y --no-install-recommends \
6+ bash \
7+ build-essential \
8+ ca-certificates \
9+ curl \
10+ lld \
11+ && rm -rf /var/lib/apt/lists/*
612
713# Set the working directory inside the container
814WORKDIR /app
915
1016# Copy the source code into the container
1117COPY . .
1218
13- # Build the project in release mode for the specific binaries
14- RUN cargo build --release --bin bolt4rs-server --bin test_client
19+ # Build against the self-contained static liblbug archive matching the Cargo dependency.
20+ RUN set -eux; \
21+ LBUG_VERSION="$(sed -n 's/^lbug = .*version = " [>=<~^ ]*\( [0-9][^", ]*\) " .*/\1 /p' server/Cargo.toml)"; \
22+ test -n "$LBUG_VERSION"; \
23+ export LBUG_VERSION; \
24+ cargo build --release --bin bolt4rs-server --bin test_client
1525
1626# Runtime stage
17- FROM alpine:latest
27+ FROM debian:bookworm-slim
1828
19- # Install ca-certificates if needed (for HTTPS, but probably not necessary here)
20- RUN apk --no-cache add ca-certificates
29+ # Install runtime dependencies for the C++ runtime linked by the server binary.
30+ RUN apt-get update && apt-get install -y --no-install-recommends \
31+ ca-certificates \
32+ libstdc++6 \
33+ && rm -rf /var/lib/apt/lists/*
2134
2235# Set the working directory inside the container
2336WORKDIR /app
@@ -37,4 +50,4 @@ ENV RUST_LOG=info
3750RUN mkdir -p /app/data /app/logs
3851
3952# Command to run the binary and log to file
40- CMD ["sh" , "-c" , "cd /app && ./bolt4rs-server > /app/logs/server.log 2>&1" ]
53+ CMD ["sh", "-c", "cd /app && ./bolt4rs-server > /app/logs/server.log 2>&1"]
0 commit comments