Files
gif/Dockerfile
LovroG05 c8b5f2e2d7
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 19s
Fix Dockerfile to use npm start and add start script
2026-01-19 23:25:57 +01:00

34 lines
533 B
Docker

# Stage 1: Build the React Application
FROM node:20-alpine AS builder
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm ci
# Copy source and build
COPY . .
RUN npm run build
# Stage 2: Serve with Node.js
FROM node:20-alpine
WORKDIR /app
# Copy package.json and install ONLY production dependencies
COPY package*.json ./
RUN npm ci --omit=dev
# Copy built frontend assets
COPY --from=builder /app/dist ./dist
# Copy server code
COPY server.js ./
# Expose port
EXPOSE 3000
# Start server
CMD ["npm", "start"]