-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (49 loc) · 1.39 KB
/
Copy pathDockerfile
File metadata and controls
62 lines (49 loc) · 1.39 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
50
51
52
53
54
55
56
57
58
59
60
61
62
# Multi-stage build for optimal image size
# Stage 1: Builder
FROM rust:1.82-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
git \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /usr/src/gramr
# Copy manifests
COPY Cargo.toml Cargo.lock ./
COPY lib/Cargo.toml lib/
COPY cli/Cargo.toml cli/
COPY wotan/Cargo.toml wotan/
COPY gramrup/Cargo.toml gramrup/
# Copy source code
COPY lib/src lib/src
COPY cli/src cli/src
COPY wotan/src wotan/src
COPY gramrup/src gramrup/src
# Build for release
RUN cargo build --release --all
# Stage 2: Runtime
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Foundry
RUN curl -L https://foundry.paradigm.xyz | bash && \
/root/.foundry/bin/foundryup
# Copy binaries from builder
COPY --from=builder /usr/src/gramr/target/release/gramr /usr/local/bin/
COPY --from=builder /usr/src/gramr/target/release/wotan /usr/local/bin/
COPY --from=builder /usr/src/gramr/target/release/gramrup /usr/local/bin/
# Add foundry to PATH
ENV PATH="/root/.foundry/bin:${PATH}"
# Create workspace directory
WORKDIR /workspace
# Verify installations
RUN gramr --version && \
wotan --help > /dev/null && \
forge --version
# Default command
CMD ["gramr", "--help"]