Tweaks, fixes, and launch prep
This commit is contained in:
26
Dockerfile
26
Dockerfile
@@ -1,10 +1,24 @@
|
||||
# Multi-stage: build both variants (dev + bio), then nginx with host-based routing.
|
||||
# Multi-stage: build both variants (dev + bio) with critical CSS, then nginx with host-based routing.
|
||||
# No buildx; plain docker build.
|
||||
|
||||
FROM node:22-bookworm-slim AS builder
|
||||
|
||||
# Chromium deps for critical CSS (Puppeteer headless)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
libasound2 \
|
||||
libatk-bridge2.0-0 \
|
||||
libatk1.0-0 \
|
||||
libcups2 \
|
||||
libdrm2 \
|
||||
libgbm1 \
|
||||
libgtk-3-0 \
|
||||
libnss3 \
|
||||
libxcomposite1 \
|
||||
libxdamage1 \
|
||||
libxfixes3 \
|
||||
libxkbcommon0 \
|
||||
libxrandr2 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
@@ -14,13 +28,16 @@ WORKDIR /app
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Install Chromium for critical CSS (used by the "critical" package)
|
||||
RUN pnpm run critical-css:install
|
||||
|
||||
COPY . .
|
||||
|
||||
# Build dev variant, move output, then build bio variant (same build/ dir).
|
||||
# Build dev variant with critical CSS, move output, then build bio variant with critical CSS.
|
||||
RUN set -e && \
|
||||
CONTENT_VARIANT=dev pnpm run build && \
|
||||
CONTENT_VARIANT=dev pnpm run build && pnpm run critical-css && \
|
||||
cp -r build /out/dev && \
|
||||
CONTENT_VARIANT=bio pnpm run build && \
|
||||
CONTENT_VARIANT=bio pnpm run build && pnpm run critical-css && \
|
||||
cp -r build /out/bio
|
||||
|
||||
# Runtime: nginx serves /out/dev and /out/bio by Host header.
|
||||
@@ -29,5 +46,6 @@ FROM nginx:alpine
|
||||
COPY --from=builder /out/dev /usr/share/nginx/html/dev
|
||||
COPY --from=builder /out/bio /usr/share/nginx/html/bio
|
||||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY nginx/snippets/ /etc/nginx/snippets/
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
Reference in New Issue
Block a user