make the app buildable for prod
This commit is contained in:
parent
1e868f1b0d
commit
b72569b6b9
7 changed files with 78 additions and 16 deletions
29
crawler/frontend/Dockerfile
Normal file
29
crawler/frontend/Dockerfile
Normal 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;"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue