FROM rust:1.50 as builder WORKDIR /app ARG APP=imspyder RUN USER=root cargo new $APP WORKDIR /app/$APP RUN mkdir -p .cargo COPY config.toml .cargo/ COPY Cargo.toml Cargo.lock ./ COPY ./src src RUN cargo install --path . --color always # Copy the app to an base Docker image, here we use distroless FROM alpine:latest RUN mkdir -p /cache COPY --from=builder /usr/local/cargo/bin/$APP /$APP USER 1000 ENTRYPOINT ["/$APP"]