Files
gif/Dockerfile
LovroG05 3450740cdf
Some checks failed
Docker Build and Push / build-and-push (push) Failing after 46s
init
2026-01-19 23:09:02 +01:00

34 lines
559 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 (server deps)
COPY package*.json ./
RUN npm ci --only=production
# Copy built frontend assets
COPY --from=builder /app/dist ./dist
# Copy server code
COPY server.js ./
# Expose port
EXPOSE 3000
# Start server
CMD ["node", "server.js"]