File size: 528 Bytes
01a4265 c764138 01a4265 eb76662 01a4265 eb76662 01a4265 eb76662 c764138 01a4265 eb76662 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Step 1: Build the React app
FROM node:18 as build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Step 2: Serve the static files with Nginx
FROM nginx:alpine
# Copy React build
COPY --from=build /app/dist /usr/share/nginx/html
# (if CRA, replace dist with build)
# Override full nginx.conf
COPY nginx.conf /etc/nginx/nginx.conf
# Ensure writable dirs
RUN mkdir -p /tmp/nginx /var/cache/nginx && \
chmod -R 777 /tmp/nginx /var/cache/nginx
EXPOSE 7860
CMD ["nginx", "-g", "daemon off;"] |