Complete production setup with Express server
Some checks failed
CI/CD / Test (push) Has been cancelled
CI/CD / Docker Build Validation (push) Has been cancelled
Docker Publish / docker-build-publish (push) Has been cancelled
Code Quality / Quality Analysis (push) Has been cancelled
Code Quality / Accessibility Tests (push) Has been cancelled
Code Quality / Performance Audit (push) Has been cancelled
Code Quality / PR Size Check (push) Has been cancelled
Security Analysis / CodeQL Analysis (javascript) (push) Has been cancelled
Security Analysis / CodeQL Analysis (typescript) (push) Has been cancelled
Security Analysis / Dependency Vulnerability Scan (push) Has been cancelled
Security Analysis / Secrets Detection (push) Has been cancelled
Update Stable Branch / prepare-release (push) Has been cancelled
Mark Stale Issues and Pull Requests / stale (push) Has been cancelled

This commit is contained in:
root
2025-12-11 17:50:51 +00:00
parent cfb60d04ce
commit f646ee43ce
6 changed files with 122 additions and 29 deletions

View File

@@ -1,24 +1,30 @@
# syntax=docker/dockerfile:1
FROM node:22-bookworm-slim AS base
# Install pnpm
RUN corepack enable && corepack prepare pnpm@9.15.9 --activate
# Install git (needed for some dependencies)
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*
apt-get install -y --no-install-recommends \
git \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Dependencies stage
FROM base AS deps
COPY package.json pnpm-lock.yaml ./
# Install ALL dependencies (needed for build)
RUN pnpm install --frozen-lockfile
# Build stage
FROM base AS build
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install ALL dependencies (including dev) for building
RUN pnpm install --frozen-lockfile
# Copy source code
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Build the app
@@ -26,19 +32,25 @@ RUN pnpm run build
# Production stage
FROM base AS production
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=8788
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install only production dependencies
RUN pnpm install --prod --frozen-lockfile
# Install production dependencies
RUN pnpm install --prod --frozen-lockfile --ignore-scripts
# Copy built files from build stage
# Copy built app
COPY --from=build /app/build ./build
COPY --from=build /app/server.mjs ./server.mjs
COPY --from=build /app/public ./public
# Expose port
EXPOSE 8788
# Start the app
CMD ["pnpm", "start"]
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
CMD node -e "require('http').get('http://localhost:8788/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
CMD ["node", "server.mjs"]