Skip to content

Commit 986ca08

Browse files
committed
New: Docker configuration done.
1 parent b476128 commit 986ca08

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Stage 1: Build React app
2+
FROM node:18 AS build
3+
4+
WORKDIR /app
5+
6+
COPY package*.json ./
7+
RUN npm install
8+
9+
COPY . .
10+
RUN npm run build
11+
12+
# Stage 2: Serve with Nginx
13+
FROM nginx:alpine
14+
15+
# Remove default static assets
16+
RUN rm -rf /usr/share/nginx/html/*
17+
18+
# Copy built files from previous stage
19+
COPY --from=build /app/dist /usr/share/nginx/html
20+
21+
# Optional: Custom Nginx config
22+
COPY nginx.conf /etc/nginx/conf.d/default.conf
23+
24+
EXPOSE 80
25+
26+
CMD ["nginx", "-g", "daemon off;"]
27+

0 commit comments

Comments
 (0)