generated from Austionian/axum_tailwind_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.prod
38 lines (30 loc) · 1.18 KB
/
Dockerfile.prod
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
FROM --platform=$BUILDPLATFORM rust:latest AS chef
WORKDIR /app
USER root:root
RUN apt update && apt upgrade
RUN apt install -y gcc-aarch64-linux-gnu
RUN rustup target add aarch64-unknown-linux-musl
RUN cargo install --locked cargo-chef sccache
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo build --release --target aarch64-unknown-linux-musl
FROM --platform=$BUILDPLATFORM alpine:3.14 AS runtime
WORKDIR /app
COPY --from=builder /app/target/aarch64-unknown-linux-musl/release/gathering_surf gathering_surf
COPY config config
COPY assets assets
COPY templates templates
ENV APP_ENVIRONMENT=production
ENTRYPOINT ["./gathering_surf"]