ux-survey/Dockerfile

50 lines
1.6 KiB
Docker

##FROM rust:latest as planner
##RUN cargo install cargo-chef
##WORKDIR /src
##COPY . /src/
##RUN cargo chef prepare --recipe-path recipe.json
##
##FROM rust:latest as cacher
##WORKDIR /src/
##RUN cargo install cargo-chef
##COPY --from=planner /src/recipe.json recipe.json
##RUN cargo chef cook --release --recipe-path recipe.json
#
#FROM rust:latest as rust
#WORKDIR /src
#COPY . .
##COPY --from=cacher /src/target target
#RUN cargo --version
#RUN cargo build --release
#
#FROM debian:bookwork as mcaptcha-ux-survey
#LABEL org.opencontainers.image.source https://github.com/mCaptcha/dos
#RUN useradd -ms /bin/bash -u 1001 mcaptcha-ux-survey
#WORKDIR /home/mcaptcha-ux-survey
#COPY --from=rust /src/target/release/mcaptcha-ux-survey /usr/local/bin/
#COPY --from=rust /src/config/default.toml /etc/mcaptcha-ux-survey/config.toml
#USER mcaptcha-ux-survey
#CMD [ "/usr/local/bin/mcaptcha-ux-survey" ]
FROM rust:slim as rust
WORKDIR /src
RUN apt-get update && apt-get install -y git pkg-config libssl-dev make
RUN mkdir src && echo "fn main() {}" > src/main.rs
COPY Cargo.toml .
RUN sed -i '/.*build.rs.*/d' Cargo.toml
COPY Cargo.lock .
RUN cargo build --release || true
COPY . /src
RUN cargo build --release
FROM debian:bookworm as mcaptcha-ux-survey
LABEL org.opencontainers.image.source https://github.com/mCaptcha/dos
RUN apt-get update && apt-get install -y ca-certificates
RUN useradd -ms /bin/bash -u 1001 mcaptcha-ux-survey
WORKDIR /home/mcaptcha-ux-survey
COPY --from=rust /src/target/release/mcaptcha-ux-survey /usr/local/bin/
COPY --from=rust /src/config/config.toml /etc/mcaptcha-ux-survey/config.toml
USER mcaptcha-ux-survey
CMD [ "/usr/local/bin/mcaptcha-ux-survey" ]