d2e20ad82a
- Change build context from ./frontend|backend to root (.) - Update Dockerfiles to copy from correct paths - Use npm install instead of npm ci (workspaces share root lockfile) - Remove obsolete version attribute from docker-compose.yml Fixes npm ci errors when package-lock.json is at workspace root.
44 lines
918 B
Docker
44 lines
918 B
Docker
# Build stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy root package files for workspace install
|
|
COPY package*.json ./
|
|
COPY frontend/package*.json ./frontend/
|
|
|
|
# Install dependencies using npm install (no individual lockfile in workspace)
|
|
RUN npm install --legacy-peer-deps
|
|
|
|
# Copy frontend source
|
|
COPY frontend/ ./frontend/
|
|
|
|
# Build Next.js app
|
|
WORKDIR /app/frontend
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
COPY frontend/package*.json ./frontend/
|
|
|
|
# Install production dependencies
|
|
RUN npm install --legacy-peer-deps --omit=dev
|
|
|
|
# Copy built files from builder
|
|
COPY --from=builder /app/frontend/.next ./frontend/.next
|
|
COPY --from=builder /app/frontend/public ./frontend/public
|
|
COPY --from=builder /app/frontend/next.config.js ./frontend/
|
|
|
|
WORKDIR /app/frontend
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Start application
|
|
CMD ["npm", "start"]
|