52 lines
1.6 KiB
Docker
52 lines
1.6 KiB
Docker
# ── Stage 1: build Vite frontend ─────────────────────────────────────────────
|
|
FROM denoland/deno:2.9.0 AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY deno.json deno.lock package.json ./
|
|
COPY tsconfig*.json vite.config.ts lingui.config.ts ./
|
|
RUN deno install
|
|
|
|
COPY index.html ./
|
|
COPY public/ ./public/
|
|
COPY src/ ./src/
|
|
COPY shared/ ./shared/
|
|
# The build extracts and compiles the catalogs, the emails' messages included.
|
|
COPY locales/ ./locales/
|
|
COPY api/mail/ ./api/mail/
|
|
|
|
# VITE_API_* are only needed when the API lives on a different host than the frontend.
|
|
ARG VITE_API_PROTOCOL
|
|
ARG VITE_API_HOSTNAME
|
|
ARG VITE_API_PORT
|
|
ENV VITE_API_PROTOCOL=$VITE_API_PROTOCOL \
|
|
VITE_API_HOSTNAME=$VITE_API_HOSTNAME \
|
|
VITE_API_PORT=$VITE_API_PORT
|
|
|
|
RUN deno task build
|
|
|
|
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
|
|
FROM denoland/deno:alpine-2.9.0
|
|
|
|
RUN apk add --no-cache ffmpeg curl
|
|
|
|
WORKDIR /app
|
|
|
|
COPY deno.json deno.lock ./
|
|
RUN deno install
|
|
|
|
COPY api/ ./api/
|
|
COPY shared/ ./shared/
|
|
COPY --from=builder /app/dist/ ./dist/
|
|
COPY --from=builder /app/locales/ ./locales/
|
|
# The emails read their colors, fonts and radii from the site's stylesheets.
|
|
COPY src/tokens.css ./src/
|
|
COPY src/themes/ ./src/themes/
|
|
|
|
# Persistent data: database and uploaded/generated files must be mounted as volumes.
|
|
VOLUME ["/app/api/sql", "/app/api/uploads"]
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["deno", "task", "start"]
|