FROM ekidd/rust-musl-builder as build USER rust WORKDIR /home/rust/src/ RUN USER=rust cargo new datatrash WORKDIR /home/rust/src/datatrash COPY --chown=rust Cargo.toml Cargo.lock ./ RUN cargo build --release --features vendored COPY --chown=rust src ./src COPY --chown=rust static ./static COPY --chown=rust template ./template COPY --chown=rust init-db.sql ./init-db.sql RUN touch src/main.rs RUN cargo install --path . --features vendored FROM alpine ENV RUST_BACKTRACE "1" COPY --from=build /home/rust/.cargo/bin/datatrash . COPY static ./static RUN mkdir ./files EXPOSE 8000 ENTRYPOINT ["./datatrash"]