make the app buildable for prod

This commit is contained in:
Viktor Barzin 2025-06-16 22:43:46 +00:00
parent 1e868f1b0d
commit b72569b6b9
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
7 changed files with 78 additions and 16 deletions

View file

@ -0,0 +1,29 @@
# Stage 1: Build the React app
FROM node:24-alpine AS builder
WORKDIR /app
# Copy package files first for better caching
COPY package.json package-lock.json* ./
# Install dependencies (prefers yarn if available)
RUN npm ci
# Copy all files and build
COPY . .
RUN npm run build # TODO: MOVE ME BELOW
FROM nginx:alpine
# Remove default nginx static files
RUN rm -rf /usr/share/nginx/html/*
WORKDIR /app
# Copy only necessary files from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]