Skip to content

Commit 2649d9d

Browse files
committed
✨ feat: 프론트엔드 도커 파일
- 프론트엔드 도커 파일 Issue Resolved: #246
1 parent e0df3aa commit 2649d9d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

front/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM node:20 AS build
2+
WORKDIR /app
3+
COPY package*.json ./
4+
# Install dependencies
5+
RUN npm install --legacy-peer-deps
6+
7+
COPY . .
8+
ARG VITE_ENVIRONMENT
9+
ARG VITE_API_URL
10+
11+
# Vite가 빌드 시점에 사용할 수 있도록 환경 변수 생성
12+
RUN echo "VITE_ENVIRONMENT=${VITE_ENVIRONMENT}" >> .env && \
13+
echo "VITE_API_URL=${VITE_API_URL}" >> .env
14+
15+
RUN npm run build
16+
17+
# Use nginx image for production stage
18+
FROM nginx:stable-alpine
19+
WORKDIR /usr/share/nginx/html
20+
RUN rm -rf ./*
21+
COPY --from=build /app/dist/ .
22+
RUN rm /etc/nginx/conf.d/default.conf
23+
COPY nginx/nginx.conf /etc/nginx/conf.d/
24+
EXPOSE 80
25+
26+
# Run nginx in the foreground
27+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)