1- FROM rust:latest as builder
1+ # Use Alpine for a musl libc environment (for static linking)
2+ FROM rust:alpine as builder
23
34WORKDIR /app
45
5- # Install system dependencies
6- RUN apt-get update && \
7- apt-get install -y pkg-config libssl-dev build-essential git && \
8- apt-get clean && \
9- rm -rf /var/lib/apt/lists/*
6+ # Install build dependencies
7+ RUN apk add --no-cache musl-dev openssl-dev pkgconfig git build-base
108
119# Copy the entire project
1210COPY . .
1311
14- # Show Rust version for debugging
15- RUN rustc --version
12+ # Build with musl for static linking
13+ RUN rustup target add x86_64-unknown-linux-musl
14+ RUN cargo build --release --target x86_64-unknown-linux-musl
1615
17- # Build the application
18- RUN cargo build --release
19-
20- # Create a smaller runtime image
21- FROM debian:bullseye-slim
16+ # Use a minimal Alpine image for runtime
17+ FROM alpine:latest
2218
2319WORKDIR /app
2420
25- # Install runtime dependencies
26- RUN apt-get update && \
27- apt-get install -y ca-certificates libssl-dev && \
28- apt-get clean && \
29- rm -rf /var/lib/apt/lists/*
21+ # Install minimal runtime dependencies
22+ RUN apk add --no-cache ca-certificates
3023
3124# Create logs directory
3225RUN mkdir -p /app/logs
3326
34- # Copy the built binary from the builder stage - using the correct binary name
35- COPY --from=builder /app/target/release/symbiotic_offchain /app/symbiotic_offchain
27+ # Copy the statically linked binary from the builder stage
28+ COPY --from=builder /app/target/x86_64-unknown-linux-musl/ release/symbiotic_offchain /app/symbiotic_offchain
3629
3730# Run the application with the FetchEvents command
38- CMD ["/app/symbiotic_offchain" , "FetchEvents " ]
31+ CMD ["/app/symbiotic_offchain" , "fetch-events " ]
0 commit comments