Update Dockerfile

This commit is contained in:
Elias Stepanik 2025-05-24 06:42:24 +02:00 committed by GitHub
parent f3f81172ee
commit f94770a2f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,26 +1,22 @@
# ---------- build stage ----------
FROM node:20-alpine AS builder
# Base image with Corepack → pnpm already included
FROM node:20-alpine
# pnpm is the package manager used by Strudel
RUN corepack enable && npm install -g pnpm # corepack ships with Node 20 :contentReference[oaicite:0]{index=0}
# Build-time tools needed by some native deps
RUN apk add --no-cache git python3 make g++ \
&& corepack enable \
&& corepack prepare pnpm@latest --activate # pin if you prefer
# native deps needed for sharp and other Astro plugins to compile on Alpine Linux :contentReference[oaicite:1]{index=1}
RUN apk add --no-cache git python3 make g++
WORKDIR /app
WORKDIR /usr/src/app
COPY . .
# deterministic install & build
RUN pnpm install --frozen-lockfile # workspace root uses pnpm :contentReference[oaicite:2]{index=2}
RUN pnpm build # produces website/dist (Astro default) :contentReference[oaicite:3]{index=3}
# 1. install monorepo deps
RUN pnpm install --frozen-lockfile
# ---------- runtime stage ----------
FROM nginx:alpine
LABEL org.opencontainers.image.source="https://github.com/tidalcycles/strudel"
# 2. generate docs once JsDoc.jsx expects this file
RUN pnpm run jsdoc-json # produces ./doc.json :contentReference[oaicite:0]{index=0}
# copy the static site produced above
COPY --from=builder /app/website/dist /usr/share/nginx/html
# Expose Astros default dev port
EXPOSE 4321 # default per Astro docs :contentReference[oaicite:1]{index=1}
EXPOSE 80
HEALTHCHECK CMD wget -qO- http://localhost/ || exit 1
CMD ["nginx","-g","daemon off;"]
# 3. launch the dev server, listen on all interfaces
CMD ["pnpm", "dev", "--", "--host", "0.0.0.0", "--port", "4321"]