datatrash/Dockerfile

32 lines
802 B
Docker
Raw Normal View History

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 DATABASE_URL "postresql://localhost"
ENV SERVER_URL "http://localhost:8000"
ENV FILES_DIR "./files"
ENV UPLOAD_MAX_BYTES "8388608"
ENV BIND_ADDRESS "0.0.0.0:8000"
ENV RUST_BACKTRACE "1"
COPY --from=build /home/rust/.cargo/bin/datatrash .
COPY static ./static
RUN mkdir ./files
EXPOSE 8000
ENTRYPOINT ["./datatrash"]