FROM rust:1-bullseye as builder RUN USER=root cargo new --bin security-orchestrator WORKDIR ./security-orchestrator COPY ./Cargo.toml ./Cargo.toml RUN cargo clean && cargo build --release RUN rm src/*.rs ADD . ./ RUN rm ./target/release/deps/security_orchestrator* RUN cargo build --release FROM debian:bullseye-slim ARG APP=/usr/src/app RUN apt-get update \ && apt-get install -y ca-certificates tzdata \ && rm -rf /var/lib/apt/lists/* ENV TZ=Etc/UTC \ APP_USER=appuser RUN groupadd $APP_USER \ && useradd -g $APP_USER $APP_USER \ && mkdir -p ${APP} COPY --from=builder /security-orchestrator/target/release/security-orchestrator ${APP}/security-orchestrator RUN chown -R $APP_USER:$APP_USER ${APP} USER $APP_USER WORKDIR ${APP} ENTRYPOINT ["./security-orchestrator"]