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>
This commit is contained in:
26
Dockerfile
26
Dockerfile
@@ -1,15 +1,21 @@
|
||||
# Stage 1: Build client
|
||||
FROM node:20-alpine AS client-builder
|
||||
# Build stage
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app/client
|
||||
WORKDIR /app
|
||||
|
||||
COPY client/package*.json ./
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install all dependencies (including client devDependencies for build)
|
||||
RUN npm install
|
||||
|
||||
COPY client/ ./
|
||||
# Copy client source for build
|
||||
COPY client/ ./client/
|
||||
|
||||
# Build the client
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production server
|
||||
# Production stage
|
||||
FROM node:20-alpine
|
||||
|
||||
# Install system dependencies for node-canvas and sharp
|
||||
@@ -26,15 +32,15 @@ RUN apk add --no-cache \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy server package files and install
|
||||
COPY server/package*.json ./server/
|
||||
RUN cd server && npm install --production
|
||||
# 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=client-builder /app/client/dist ./server/dist
|
||||
COPY --from=builder /app/client/dist ./server/dist
|
||||
|
||||
# Create data directories
|
||||
RUN mkdir -p /app/server/uploads /app/server/exports
|
||||
|
||||
Reference in New Issue
Block a user