rust-nex/Dockerfile

58 lines
2.6 KiB
Text
Raw Normal View History

2026-04-29 01:23:18 +02:00
# syntax=docker/dockerfile:1
FROM rust:alpine AS chef
RUN apk add --no-cache musl-dev lld g++ make
RUN cargo install cargo-chef
2025-03-25 07:30:10 +00:00
WORKDIR /app
2026-04-29 01:23:18 +02:00
FROM chef AS planner
2025-03-25 07:30:10 +00:00
COPY . .
2026-04-29 01:23:18 +02:00
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
2026-07-14 19:48:57 +02:00
RUN apk add --no-cache protobuf-dev git openssl-dev openssl-libs-static bash yq ca-certificates
2025-03-25 07:30:10 +00:00
2026-04-29 01:23:18 +02:00
COPY --from=planner /app/recipe.json recipe.json
2025-11-13 14:34:11 +01:00
ARG EDITION
2026-04-26 16:41:40 +02:00
ARG DATABASE_URL
2025-11-13 14:06:08 +01:00
2026-06-05 20:07:58 +02:00
RUN --mount=type=cache,id=${EDITION}-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=${EDITION}-target,target=/app/target \
2026-04-29 01:23:18 +02:00
cargo chef cook --release --recipe-path recipe.json --target x86_64-unknown-linux-musl && \
cargo chef cook --tests --target x86_64-unknown-linux-musl --recipe-path recipe.json
COPY . .
2026-06-05 20:07:58 +02:00
RUN --mount=type=cache,id=${EDITION}-registry,target=/usr/local/cargo/registry \
2026-06-05 20:10:16 +02:00
--mount=type=cache,id=${EDITION}-target,target=/app/target \
2026-05-29 08:00:01 +02:00
RNEX_STATIC=1 ./test-edition.sh && RNEX_STATIC=1 ./build-edition.sh && \
2026-04-29 01:23:18 +02:00
mkdir -p /app/dist && \
cp /app/target/x86_64-unknown-linux-musl/release/rnex-server-backend-node-holder /app/dist/ && \
2026-04-29 01:23:18 +02:00
cp /app/target/x86_64-unknown-linux-musl/release/proxy_insecure /app/dist/ && \
cp /app/target/x86_64-unknown-linux-musl/release/proxy_secure /app/dist/ && \
cp /app/target/x86_64-unknown-linux-musl/release/rnex-server-backend-auth /app/dist/ && \
cp /app/target/x86_64-unknown-linux-musl/release/rnex-server-backend-secure /app/dist/
2025-03-25 07:30:10 +00:00
2025-11-05 21:54:47 +01:00
FROM scratch AS node-holder
2026-07-14 19:48:57 +02:00
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/dist/rnex-server-backend-node-holder /rnex-server-backend-node-holder
ENTRYPOINT ["/rnex-server-backend-node-holder"]
2025-03-25 07:30:10 +00:00
2026-01-31 22:04:54 +01:00
FROM scratch AS proxy-insecure
2026-07-14 19:48:57 +02:00
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
2026-04-29 01:23:18 +02:00
COPY --from=builder /app/dist/proxy_insecure /proxy_insecure
2025-11-05 21:54:47 +01:00
ENTRYPOINT ["/proxy_insecure"]
2026-01-31 22:04:54 +01:00
FROM scratch AS proxy-secure
2026-07-14 19:48:57 +02:00
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
2026-04-29 01:23:18 +02:00
COPY --from=builder /app/dist/proxy_secure /proxy_secure
2025-11-05 21:54:47 +01:00
ENTRYPOINT ["/proxy_secure"]
2026-01-31 22:04:54 +01:00
2025-11-05 21:54:47 +01:00
FROM scratch AS backend-auth
2026-07-14 19:48:57 +02:00
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/dist/rnex-server-backend-auth /rnex-server-backend-auth
ENTRYPOINT ["/rnex-server-backend-auth"]
2025-11-05 21:54:47 +01:00
FROM scratch AS backend-secure
2026-07-14 19:48:57 +02:00
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/dist/rnex-server-backend-secure /rnex-server-backend-secure
ENTRYPOINT ["/rnex-server-backend-secure"]