-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (24 loc) · 846 Bytes
/
Dockerfile
File metadata and controls
28 lines (24 loc) · 846 Bytes
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
FROM --platform=$BUILDPLATFORM rust:alpine AS chef
ARG LOCK_FLAG="--locked"
USER root
RUN apk add --no-cache \
musl-dev \
build-base \
curl \
ca-certificates
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | sh
RUN cargo binstall cargo-chef
WORKDIR /discord-bot
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /discord-bot/recipe.json recipe.json
RUN cargo chef cook ${LOCK_FLAG} --release --recipe-path recipe.json
COPY . .
RUN cargo build ${LOCK_FLAG} --release
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /discord-bot/target/release/discord-bot /discord-bot
COPY LICENSE README.md ./
CMD ["/discord-bot"]