-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
32 lines (24 loc) · 991 Bytes
/
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
# syntax=docker/dockerfile:1.4
FROM lukemathwalker/cargo-chef:0.1.39-rust-1.62.1 AS chef
WORKDIR /app
FROM chef AS planner
COPY --link . .
RUN cargo chef prepare --recipe-path recipe.json
FROM bufbuild/buf:1.22.0 as buf
FROM namely/protoc:1.42_2 as protoc
FROM chef AS build-env
COPY --from=planner --link /app/recipe.json recipe.json
COPY --from=buf --link /usr/local/bin/buf /usr/local/bin/
COPY --from=protoc --link /usr/local/bin/protoc /usr/local/bin/
# We need these because cargo chef cook will require protoc to build some modules
ARG PROTOC_NO_VENDOR=true
ARG PROTOC=/usr/local/bin/protoc
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY --link . .
RUN cargo build --release
FROM gcr.io/distroless/cc
LABEL org.opencontainers.image.source=https://github.com/GiganticMinecraft/seichi-game-api
COPY --from=build-env --link /app/target/release/seichi-game-api /
CMD ["./seichi-game-api"]