improve dockerfile dependency caching and file system structure
This commit is contained in:
parent
2eb816134d
commit
76fd093756
20
Dockerfile
20
Dockerfile
|
@ -1,4 +1,4 @@
|
|||
FROM ekidd/rust-musl-builder as build
|
||||
FROM ekidd/rust-musl-builder:latest as build
|
||||
|
||||
USER rust
|
||||
WORKDIR /home/rust/src/
|
||||
|
@ -13,14 +13,20 @@ 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
|
||||
RUN cargo build --release --features vendored
|
||||
|
||||
FROM alpine
|
||||
FROM alpine:latest
|
||||
|
||||
ENV RUST_BACKTRACE "1"
|
||||
|
||||
COPY --from=build /home/rust/.cargo/bin/datatrash .
|
||||
COPY static ./static
|
||||
RUN mkdir ./files
|
||||
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 ["./datatrash"]
|
||||
ENTRYPOINT ["/opt/datatrash/datatrash"]
|
||||
|
|
Loading…
Reference in New Issue