- Add BuildKit cache mounts for NuGet and npm to persist package caches across builds - Skip redundant restore on dotnet publish with --no-restore - Add --prefer-offline to npm ci to prefer cached tarballs - Tag images as randall/backend:latest and randall/frontend:latest via compose image: key Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
739 B
Docker
26 lines
739 B
Docker
# Build stage
|
|
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
|
|
# Install dependencies — copy lockfiles first to cache the npm layer
|
|
COPY src/frontend/package.json src/frontend/package-lock.json ./
|
|
RUN --mount=type=cache,id=npm,target=/root/.npm \
|
|
npm ci --prefer-offline
|
|
|
|
# Copy source
|
|
COPY src/frontend/index.html ./
|
|
COPY src/frontend/vite.config.ts ./
|
|
COPY src/frontend/tsconfig.json src/frontend/tsconfig.app.json src/frontend/tsconfig.node.json ./
|
|
COPY src/frontend/eslint.config.js ./
|
|
COPY src/frontend/src/ ./src/
|
|
COPY src/frontend/public/ ./public/
|
|
|
|
RUN npm run build
|
|
|
|
# Serve stage
|
|
FROM nginx:alpine AS runtime
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
COPY cicd/docker/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|