43 lines
1.4 KiB
Docker
43 lines
1.4 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
#
|
|
# Single-shot build image for the Astro site. The production deployment uses
|
|
# nginx:1.27-alpine with a bind mount to apps/web/dist (see docker-compose.yml),
|
|
# so the webhook can rewrite the site without rebuilding any image.
|
|
#
|
|
# You only need this Dockerfile if you want a self-contained static site
|
|
# image (e.g. for a registry). For the normal homeserver flow, this image
|
|
# is never built.
|
|
#
|
|
# `corepack` reads the `packageManager` field from apps/web/package.json
|
|
# so we don't pin a version here.
|
|
|
|
FROM node:20-alpine AS base
|
|
RUN corepack enable
|
|
WORKDIR /repo
|
|
|
|
FROM base AS deps
|
|
COPY pnpm-workspace.yaml package.json ./
|
|
COPY apps/web/package.json ./apps/web/package.json
|
|
COPY apps/cms/package.json ./apps/cms/package.json
|
|
COPY pnpm-lock.yaml* ./
|
|
RUN if [ -f pnpm-lock.yaml ]; then \
|
|
pnpm install --frozen-lockfile; \
|
|
else \
|
|
echo "No pnpm-lock.yaml found; running pnpm install (generates one)"; \
|
|
pnpm install; \
|
|
fi
|
|
|
|
FROM deps AS build
|
|
ENV PUBLIC_PAYLOAD_API=https://cms.softvowels.example
|
|
ENV PUBLIC_SITE_URL=https://softvowels.example
|
|
ENV PAYLOAD_API_INTERNAL=http://cms:3000
|
|
COPY apps/web ./apps/web
|
|
WORKDIR /repo/apps/web
|
|
RUN pnpm run build
|
|
|
|
FROM nginx:1.27-alpine AS runtime
|
|
COPY --from=build /repo/apps/web/dist /usr/share/nginx/html
|
|
COPY apps/web/nginx-default.conf /etc/nginx/conf.d/default.conf
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|