rust-nex/Dockerfile

57 lines
2.1 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
RUN apk add --no-cache protobuf-dev git openssl-dev openssl-libs-static bash yq
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-04-29 01:23:18 +02:00
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
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 . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
./test-edition.sh && ./build-edition.sh && \
mkdir -p /app/dist && \
cp /app/target/x86_64-unknown-linux-musl/release/edge_node_holder_server /app/dist/ && \
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/backend_server_insecure /app/dist/ && \
cp /app/target/x86_64-unknown-linux-musl/release/backend_server_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-04-29 01:23:18 +02:00
COPY --from=builder /app/dist/edge_node_holder_server /edge_node_holder_server
2025-11-05 21:54:47 +01:00
ENTRYPOINT ["/edge_node_holder_server"]
2025-03-25 07:30:10 +00:00
2026-01-31 22:04:54 +01:00
FROM scratch AS proxy-insecure
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-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-04-29 01:23:18 +02:00
COPY --from=builder /app/dist/backend_server_insecure /backend_server_insecure
2025-11-07 18:06:22 +00:00
ENTRYPOINT ["/backend_server_insecure"]
2025-11-05 21:54:47 +01:00
FROM scratch AS backend-secure
2026-04-29 01:23:18 +02:00
COPY --from=builder /app/dist/backend_server_secure /backend_server_secure
2025-11-05 21:54:47 +01:00
ENTRYPOINT ["/backend_server_secure"]
2025-11-05 22:47:06 +01:00
2026-04-29 01:23:18 +02:00
FROM chef AS dev-container
RUN apk add --no-cache openjdk21-jdk gcompat git bash protobuf-dev
COPY --from=builder /app/dist/* /usr/local/bin/