chore: dockerfile update
This commit is contained in:
+25
-16
@@ -1,33 +1,42 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
#
|
||||
# Single-shot build image for the Astro site. The production deployment uses
|
||||
# this Dockerfile to produce apps/web/dist, then `docker-compose.yml` mounts
|
||||
# that folder into a plain nginx:alpine container (so re-builds from the
|
||||
# webhook don't require a `docker build` / push step).
|
||||
# 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 image if you want a self-contained static site image
|
||||
# (e.g. for a registry). For the normal homeserver flow, just use
|
||||
# `docker compose up -d --build web` — there is no `web` service to build.
|
||||
# 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 && corepack prepare [email protected] --activate
|
||||
WORKDIR /app
|
||||
RUN corepack enable
|
||||
WORKDIR /repo
|
||||
|
||||
FROM base AS deps
|
||||
COPY package.json pnpm-lock.yaml* ./
|
||||
COPY ../../package.json ../../pnpm-workspace.yaml* ../../ ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
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 base AS build
|
||||
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 --from=deps /app /app
|
||||
COPY . .
|
||||
COPY apps/web ./apps/web
|
||||
WORKDIR /repo/apps/web
|
||||
RUN pnpm run build
|
||||
|
||||
FROM nginx:1.27-alpine AS runtime
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY nginx-default.conf /etc/nginx/conf.d/default.conf
|
||||
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;"]
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "[email protected]",
|
||||
"engines": {
|
||||
"node": ">=20.11.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"start": "astro dev",
|
||||
|
||||
Reference in New Issue
Block a user