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