Skip to content

Commit e3899ae

Browse files
committed
docker_update
1 parent d5da5be commit e3899ae

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

symbiotic_offchain/Dockerfile

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
FROM rust:latest as builder
1+
# Use Alpine for a musl libc environment (for static linking)
2+
FROM rust:alpine as builder
23

34
WORKDIR /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
1210
COPY . .
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

2319
WORKDIR /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
3225
RUN 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"]

symbiotic_offchain/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.8'
1+
# Docker Compose configuration
22

33
services:
44
symbiotic-restaking:

0 commit comments

Comments
 (0)