Files
apparel-designer/Dockerfile
Khalid A 66bd69efe7 Consolidate to single server with unified package.json
- Merge client and server dependencies into root package.json
- Remove separate client/package.json and server/package.json
- Update server/index.js to serve built client static files
- Simplify Dockerfile to single build + production stage
- Update dev scripts for unified development workflow
- SPA routing serves index.html for non-API routes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 22:24:20 -05:00

55 lines
1.1 KiB
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install all dependencies (including client devDependencies for build)
RUN npm install
# Copy client source for build
COPY client/ ./client/
# Build the client
RUN npm run build
# Production stage
FROM node:20-alpine
# Install system dependencies for node-canvas and sharp
RUN apk add --no-cache \
cairo-dev \
pango-dev \
libjpeg-turbo-dev \
giflib-dev \
librsvg-dev \
pixman-dev \
python3 \
make \
g++
WORKDIR /app
# Copy package files and install production dependencies only
COPY package*.json ./
RUN npm install --production
# Copy server source
COPY server/ ./server/
# Copy built client from builder
COPY --from=builder /app/client/dist ./server/dist
# Create data directories
RUN mkdir -p /app/server/uploads /app/server/exports
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3001/api/health || exit 1
EXPOSE 3001
CMD ["node", "server/index.js"]