Skip to content

Commit a2d2533

Browse files
authored
Update Dockerfile
1 parent ebc5c89 commit a2d2533

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

frontend/Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Multi-stage build for React app
2+
FROM node:18-alpine AS build
3+
4+
WORKDIR /app
5+
6+
# Install specific npm version
7+
RUN npm install -g npm@9.8.1
8+
9+
# Copy package files
10+
COPY package*.json ./
11+
12+
# Install all dependencies (including devDependencies for build)
13+
RUN npm ci
14+
15+
# Copy source code
16+
COPY . .
17+
18+
# Build the app
19+
RUN npm run build
20+
21+
# Production stage with nginx
22+
FROM nginx:alpine
23+
24+
# Copy built app to nginx
25+
COPY --from=build /app/build /usr/share/nginx/html
26+
27+
# Copy custom nginx config
28+
COPY nginx.conf /etc/nginx/conf.d/default.conf
29+
30+
# Expose port 80
31+
EXPOSE 80
32+
33+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)