2021-10-26 21:31:21 +00:00
|
|
|
FROM rust:alpine3.14 as builder
|
2020-07-11 22:16:36 +00:00
|
|
|
|
2021-10-26 21:31:21 +00:00
|
|
|
WORKDIR /app
|
|
|
|
RUN apk add musl-dev
|
2020-07-11 22:16:36 +00:00
|
|
|
|
2021-10-26 21:31:21 +00:00
|
|
|
RUN cargo init
|
|
|
|
COPY Cargo.toml Cargo.lock ./
|
|
|
|
RUN cargo build --release --target=x86_64-unknown-linux-musl
|
2020-07-11 22:16:36 +00:00
|
|
|
|
2021-10-26 21:31:21 +00:00
|
|
|
COPY src ./src
|
|
|
|
COPY static ./static
|
|
|
|
COPY template ./template
|
|
|
|
COPY snippet ./snippet
|
|
|
|
COPY init-db.sql ./init-db.sql
|
2020-07-12 00:26:11 +00:00
|
|
|
RUN touch src/main.rs
|
2021-10-26 21:31:21 +00:00
|
|
|
RUN cargo build --release --target=x86_64-unknown-linux-musl
|
|
|
|
RUN strip /app/target/x86_64-unknown-linux-musl/release/datatrash
|
2020-07-11 22:16:36 +00:00
|
|
|
|
|
|
|
|
2020-07-12 00:26:11 +00:00
|
|
|
|
2021-10-26 21:31:21 +00:00
|
|
|
FROM alpine:3.14
|
2020-08-04 21:43:50 +00:00
|
|
|
|
2021-10-26 21:31:21 +00:00
|
|
|
WORKDIR /opt/datatrash
|
|
|
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/datatrash ./
|
|
|
|
COPY static ./static
|
|
|
|
RUN mkdir ./files
|
2020-08-04 21:43:50 +00:00
|
|
|
|
2020-07-12 00:26:11 +00:00
|
|
|
EXPOSE 8000
|
2020-08-04 21:43:50 +00:00
|
|
|
ENTRYPOINT ["/opt/datatrash/datatrash"]
|