datatrash/Dockerfile

35 lines
839 B
Docker
Raw Normal View History

FROM ekidd/rust-musl-builder:beta 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 ./
2021-03-09 23:15:18 +00:00
RUN cargo build --release
COPY --chown=rust src ./src
COPY --chown=rust static ./static
COPY --chown=rust template ./template
2021-08-18 21:27:55 +00:00
COPY --chown=rust snippet ./snippet
COPY --chown=rust init-db.sql ./init-db.sql
RUN touch src/main.rs
2021-03-09 23:15:18 +00:00
RUN cargo build --release
2020-12-03 22:30:54 +00:00
RUN strip target/x86_64-unknown-linux-musl/release/datatrash
FROM alpine:latest
ENV RUST_BACKTRACE "1"
RUN mkdir /opt/datatrash
WORKDIR /opt/datatrash
COPY --from=build \
/home/rust/src/datatrash/target/x86_64-unknown-linux-musl/release/datatrash \
/opt/datatrash/
COPY static /opt/datatrash/static
RUN mkdir /opt/datatrash/files
EXPOSE 8000
ENTRYPOINT ["/opt/datatrash/datatrash"]