We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 851eae4 commit cb27c61Copy full SHA for cb27c61
frontend/Dockerfile
@@ -1,7 +1,27 @@
1
-FROM node:20
+# --- Stage 1: Build React app ---
2
+FROM node:18 AS build
3
WORKDIR /app
-COPY package.json ./
4
+
5
+# Install dependencies
6
+COPY package.json package-lock.json ./
7
RUN npm install
8
9
+# Copy source and build
10
COPY . .
-EXPOSE 8080
-CMD ["npm", "start"]
11
+RUN npm run build
12
13
+# --- Stage 2: Serve with Nginx ---
14
+FROM nginx:alpine
15
+WORKDIR /usr/share/nginx/html
16
17
+# Remove default nginx index page
18
+RUN rm -rf ./*
19
20
+# Copy built React app from builder
21
+COPY --from=build /app/build .
22
23
+# Copy custom nginx config
24
+COPY nginx.conf /etc/nginx/conf.d/default.conf
25
26
+EXPOSE 80
27
+CMD ["nginx", "-g", "daemon off;"]
0 commit comments