build: optimize the production Dockerfile

This commit is contained in:
Matouš Volf 2024-09-13 10:11:04 +02:00
parent d41879d8ed
commit 409a8fa2a9

View File

@ -1,4 +1,4 @@
FROM rust:1.80-bookworm as builder
FROM rust:1.80-bookworm AS builder
RUN rustup target add wasm32-unknown-unknown && \
cargo install dioxus-cli diesel_cli && \
@ -16,7 +16,14 @@ FROM debian:bookworm-slim AS runner
RUN apt-get update && apt-get install -y libpq5
COPY --from=builder /srv/app/dist /srv/app/dist
COPY ./.env /srv/app/.env
COPY .env /srv/app/.env
RUN chown -R 1000:1000 /srv/app
WORKDIR /srv/app
HEALTHCHECK CMD curl --fail http://localhost:8000 || exit 1
USER 1000:1000
CMD ["./dist/todo-baggins"]