Files
router-lists-ui/Dockerfile
T
denozord 9582105258
Publish Docker image / build-and-push (push) Successful in 2m7s
Fix: Downgrade to Express v4 and rebuild deps in Docker
2025-07-07 13:37:11 +07:00

32 lines
835 B
Docker

# Stage 1: Build React frontend
FROM node:18-slim AS frontend-builder
WORKDIR /app/frontend
# Copy package.json ONLY and install dependencies from scratch
# This avoids issues with lock files generated on different OS (e.g. Windows -> Linux)
COPY frontend/package.json ./
RUN npm install
# Copy rest of the frontend code and build
COPY frontend/ .
RUN npm run build
# Stage 2: Setup Node.js backend and serve everything
FROM node:18-slim
WORKDIR /app
# Copy package.json ONLY and install production dependencies from scratch
COPY backend/package.json ./
RUN npm install --omit=dev
# Copy rest of the backend code
COPY backend/ .
# Copy built frontend assets from the previous stage
COPY --from=frontend-builder /app/frontend/dist ./public
# The port the backend runs on
EXPOSE 3001
# Start the server
CMD ["node", "server.js"]