24 lines
874 B
Docker
24 lines
874 B
Docker
# ---------- Build stage ----------
|
|
FROM node:22-bullseye-slim AS build
|
|
WORKDIR /app
|
|
|
|
# Install dependencies first (better layer caching)
|
|
# Do not copy package-lock.json: regenerate inside the build container so
|
|
# optional/native deps are resolved for the build host platform (avoids
|
|
# npm/optional-deps bug where lockfile pins a different platform binary).
|
|
COPY package.json ./
|
|
COPY apps/web/package.json apps/web/package.json
|
|
# Install resolving optional native deps for the current builder platform
|
|
RUN npm install --no-optional --no-audit --no-fund
|
|
|
|
# Copy source and build the static site
|
|
COPY apps/web apps/web
|
|
RUN npm run build --workspace apps/web
|
|
|
|
# ---------- Production stage ----------
|
|
FROM nginx:stable-alpine
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /app/dist/apps/web /usr/share/nginx/html
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|