-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (38 loc) · 1.24 KB
/
Dockerfile
File metadata and controls
50 lines (38 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Multi-stage build for optimal image size and build consistency
FROM rust:1-bookworm as builder
WORKDIR /build
# Install system deps commonly needed for Rust + TLS
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
pkg-config \
libssl-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency manifests
COPY Cargo.toml Cargo.lock ./
# Cache dependencies by building a dummy binary first
RUN mkdir -p src && \
echo "fn main() {}" > src/main.rs && \
cargo build --release --locked && \
rm -rf src
# Copy source and build the actual binary
COPY . .
RUN cargo build --release --locked && \
cargo install --path . --locked
# Runtime stage
FROM debian:bookworm-slim
WORKDIR /workspace
# Install only runtime deps and Stellar CLI
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Stellar CLI (used by `starforge shell` sandbox execution)
RUN (curl -fsSL https://stellar.org/install.sh | bash) || true
# Copy binary from builder
COPY --from=builder /usr/local/cargo/bin/starforge /usr/local/bin/
# Set starforge as default entrypoint
ENTRYPOINT ["starforge"]
CMD ["--help"]