-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
49 lines (41 loc) · 1.37 KB
/
Dockerfile
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
# -------- Builder Stage --------
FROM rust:latest AS builder
WORKDIR /app
# Install necessary packages.
# - lld and clang are for linking.
# - openssl and ca-certificates are needed to verify TLS certificates when
# establishing HTTPS connections.
# - curl is for downloading the forge binary.
# - git is for downloading repos during verification.
RUN apt-get update && \
apt-get install -y lld clang openssl ca-certificates curl git && \
# Clean up.
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
# Install forge.
RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="/root/.foundry/bin:${PATH}"
RUN foundryup
# Copy all files to our Docker image.
COPY . .
# Build the binary.
RUN cargo build --release
# -------- Runtime Stage --------
FROM debian:bullseye-slim AS runtime
WORKDIR /app
# Install necessary packages.
# This is similar but not identical to the builder stage's install.
RUN apt-get update && \
apt-get install -y openssl ca-certificates git && \
# Clean up.
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
# Copy the binary from the builder stage.
COPY --from=builder /app/target/release/cove cove
COPY --from=builder /root/.foundry/bin/forge /usr/local/bin/forge
COPY config config
ENV APP_ENVIRONMENT production
# Launch binary when `docker run` is executed.
ENTRYPOINT ["./cove"]