Add Dockerfile and finalize build config

This commit is contained in:
2026-05-22 04:41:26 +02:00
parent e0697c9522
commit 54b242fa3a
5 changed files with 471 additions and 6 deletions

37
Dockerfile Normal file
View File

@@ -0,0 +1,37 @@
# ---- Build stage ----
FROM node:22-alpine AS builder
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy dependency manifests
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY .npmrc ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy source
COPY . .
# Build the app
RUN pnpm run build
# ---- Production stage ----
FROM node:22-alpine AS runner
WORKDIR /app
# Copy built app
COPY --from=builder /app/build ./build
COPY --from=builder /app/package.json ./
COPY --from=builder /app/node_modules ./node_modules
# Expose the port
ENV PORT=3000
EXPOSE 3000
# Start the server
CMD ["node", "build/index.js"]