All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 19s
34 lines
533 B
Docker
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"]
|