summaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 132af07fad58a47fdc247d11b967e73727545a1f (plain)
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
FROM messense/rust-musl-cross:aarch64-musl AS base
RUN cargo install cargo-chef --locked

#######################
FROM base AS planner
WORKDIR /app
#####
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock
COPY ./src ./src
#####
RUN cargo chef prepare --recipe-path recipe.json

#######################
FROM base AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
#####
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock
COPY ./src ./src
COPY ./static ./static
#####
RUN cargo build --release

#######################
FROM --platform=linux/aarch64 alpine:3.20

RUN apk add --no-cache curl ca-certificates
COPY --from=builder /home/rust/src/target/aarch64-unknown-linux-musl/release/musicgame /app/server
COPY ./static /app/static

ENV PATH="${PATH}:/app"
ENV STATIC_DIR="/app/static/"
ENV STAGE="prod"

WORKDIR "/app"

EXPOSE 4800