31 lines
674 B
Docker
31 lines
674 B
Docker
FROM rust:alpine as builder
|
|
|
|
WORKDIR /app
|
|
RUN apk add musl-dev
|
|
|
|
RUN cargo init
|
|
COPY Cargo.toml Cargo.lock ./
|
|
RUN cargo build --release --target=x86_64-unknown-linux-musl
|
|
|
|
COPY src ./src
|
|
COPY static ./static
|
|
COPY template ./template
|
|
COPY snippet ./snippet
|
|
COPY init-db.sql ./init-db.sql
|
|
COPY mime.types ./mime.types
|
|
RUN touch src/main.rs
|
|
RUN cargo build --release --target=x86_64-unknown-linux-musl
|
|
RUN strip /app/target/x86_64-unknown-linux-musl/release/datatrash
|
|
|
|
|
|
|
|
FROM alpine
|
|
|
|
WORKDIR /opt/datatrash
|
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/datatrash ./
|
|
COPY static ./static
|
|
RUN mkdir ./files
|
|
|
|
EXPOSE 8000
|
|
ENTRYPOINT ["/opt/datatrash/datatrash"]
|