crablog/Dockerfile
2023-10-19 13:40:13 +04:00

35 lines
780 B
Docker

FROM clux/muslrust:stable as builder
WORKDIR /app
RUN USER=root cargo new crablog
WORKDIR /app/crablog
COPY Cargo.toml Cargo.lock ./
RUN echo 'fn main() { println!("Dummy") }' > ./src/main.rs
RUN cargo build --release
RUN rm -r target/x86_64-unknown-linux-musl/release/.fingerprint/crablog-*
COPY src src/
COPY migrations migrations/
COPY templates templates/
RUN cargo build --release --frozen --bin crablog
FROM alpine:latest
COPY --from=builder /app/crablog/migrations /application/migrations
COPY --from=builder /app/crablog/templates /application/templates
COPY --from=builder /app/crablog/target/x86_64-unknown-linux-musl/release/crablog /application/crablog
EXPOSE 8000
ENV DATABASE_URL postgres://root@postgres/crablog
WORKDIR /application
CMD ["./crablog"]