datatrash/Dockerfile

30 lines
654 B
Docker
Raw Normal View History

FROM rust:alpine3.14 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
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:3.14
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"]