deploy without node
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -3,15 +3,31 @@ FROM node:24-alpine AS builder
|
||||
WORKDIR /app/site
|
||||
|
||||
COPY site/package.json site/package-lock.json ./
|
||||
RUN npm ci
|
||||
RUN npm ci --no-audit --no-fund
|
||||
|
||||
COPY site/ ./
|
||||
# Content is fetched before build (typically in CI) and committed into the build context at
|
||||
# `site/content/cache/content.json`. If env vars aren't configured, the fetch step gracefully
|
||||
# skips sources and/or uses last-known-good cache.
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
ARG BUILD_SHA=unknown
|
||||
ARG BUILD_DATE=unknown
|
||||
ARG BUILD_REF=unknown
|
||||
|
||||
LABEL org.opencontainers.image.title="fast-website"
|
||||
LABEL org.opencontainers.image.description="Lightweight, SEO-first static site packaged as an nginx image."
|
||||
LABEL org.opencontainers.image.revision=$BUILD_SHA
|
||||
LABEL org.opencontainers.image.created=$BUILD_DATE
|
||||
LABEL org.opencontainers.image.source=$BUILD_REF
|
||||
|
||||
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=builder /app/site/dist/ /usr/share/nginx/html/
|
||||
|
||||
EXPOSE 80
|
||||
# Operator-friendly version visibility.
|
||||
RUN printf '{\n "sha": "%s",\n "builtAt": "%s",\n "ref": "%s"\n}\n' "$BUILD_SHA" "$BUILD_DATE" "$BUILD_REF" \
|
||||
> /usr/share/nginx/html/build.json
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
Reference in New Issue
Block a user