rust-nex/Dockerfile
2025-11-13 08:39:39 +01:00

44 lines
1.8 KiB
Docker

FROM rust:alpine AS build-container
RUN apk add --no-cache protobuf-dev git musl-dev lld openssl-dev openssl-libs-static
FROM build-container AS builder
WORKDIR /app
COPY . .
RUN git submodule update --init --recursive
RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C relocation-model=static -C linker=ld.lld" cargo test --features rmc_struct_header --target x86_64-unknown-linux-musl
RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C relocation-model=static -C linker=ld.lld" cargo build --features rmc_struct_header --release --target x86_64-unknown-linux-musl #
FROM scratch AS node-holder
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/edge_node_holder_server /edge_node_holder_server
ENTRYPOINT ["/edge_node_holder_server"]
FROM alpine:latest AS proxy-insecure-v1
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/proxy_insecure /proxy_insecure
RUN apk add --no-cache ca-certificates
RUN update-ca-certificates
ENTRYPOINT ["/proxy_insecure"]
FROM alpine:latest AS proxy-secure-v1
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/proxy_secure /proxy_secure
RUN apk add --no-cache ca-certificates
RUN update-ca-certificates
ENTRYPOINT ["/proxy_secure"]
FROM scratch AS backend-auth
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/backend_server_insecure /backend_server_insecure
ENTRYPOINT ["/backend_server_insecure"]
FROM scratch AS backend-secure
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/backend_server_secure /backend_server_secure
ENTRYPOINT ["/backend_server_secure"]
# make sure the final output container is the dev container so that we can use it from the devcontainer.json
FROM build-container AS dev-container
RUN apk add openjdk21-jdk gcompat