prod
This commit is contained in:
42
ht_booking/Dockerfile
Normal file
42
ht_booking/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
||||
# Production image for ht_booking (Tenis Rajec).
|
||||
#
|
||||
# Three stages:
|
||||
# css — compiles the Tailwind/daisyUI stylesheet with Node
|
||||
# builder — compiles the release binary with Rust
|
||||
# runtime — slim Debian image holding just the binary + assets
|
||||
#
|
||||
# Built and run via docker-compose.prod.yml — see DEPLOY.md.
|
||||
|
||||
# ---- Stage 1 — Tailwind + daisyUI stylesheet -------------------------------
|
||||
FROM node:20-slim AS css
|
||||
WORKDIR /build
|
||||
COPY package.json package-lock.json tailwind.config.js ./
|
||||
RUN npm ci
|
||||
COPY assets/css ./assets/css
|
||||
COPY assets/views ./assets/views
|
||||
RUN mkdir -p assets/static/css && npm run build:css
|
||||
|
||||
# ---- Stage 2 — release binary ----------------------------------------------
|
||||
FROM rust:1.87.0-slim AS builder
|
||||
WORKDIR /usr/src
|
||||
COPY . .
|
||||
RUN cargo build --release --bin ht_booking-cli
|
||||
|
||||
# ---- Stage 3 — runtime -----------------------------------------------------
|
||||
FROM debian:bookworm-slim
|
||||
# ca-certificates: outbound TLS. curl: the container healthcheck.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /usr/app
|
||||
COPY --from=builder /usr/src/target/release/ht_booking-cli ht_booking-cli
|
||||
COPY --from=builder /usr/src/assets assets
|
||||
COPY --from=builder /usr/src/config config
|
||||
# Replace the committed CSS with one freshly built from the current templates,
|
||||
# so the image is always self-consistent regardless of what was committed.
|
||||
COPY --from=css /build/assets/static/css/app.css assets/static/css/app.css
|
||||
# Selects config/production.yaml at startup.
|
||||
ENV LOCO_ENV=production
|
||||
EXPOSE 5150
|
||||
ENTRYPOINT ["/usr/app/ht_booking-cli"]
|
||||
CMD ["start"]
|
||||
Reference in New Issue
Block a user