forked from TEAM-SYLUV/SYLUV-FE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.prod
78 lines (54 loc) · 1.8 KB
/
Dockerfile.prod
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Build stage
FROM node:lts AS build
WORKDIR /app
COPY package.json .
RUN npm i
COPY . .
# Build arguments for React environment variables
ARG REACT_APP_API_URL
ARG REACT_APP_OTHER_ENV
# Set environment variables for React build
ENV REACT_APP_API_URL $REACT_APP_API_URL
ENV REACT_APP_OTHER_ENV $REACT_APP_OTHER_ENV
RUN npm run build
# Production stage
FROM nginx:stable-alpine
# nginx의 기본 설정을 삭제하고 앱에서 설정한 파일을 복사
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx
# 위 스테이지에서 생성한 빌드 결과를 nginx의 샘플 앱이 사용하던 폴더로 이동
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80
# nginx 실행
CMD [ "nginx", "-g", "daemon off;" ]
# Build stage
FROM node:lts AS build
WORKDIR /app
COPY package.json .
RUN npm i
COPY . .
# Build arguments for React environment variables
ARG REACT_APP_KAKAO_JS_KEY
ARG REACT_APP_KAKAO_REST_API_KEY
ARG REACT_APP_KAKAO_REDIRECT_URI
ARG REACT_APP_BASE_URL
ARG REACT_APP_TOSS_CLIENT_KEY
ARG REACT_APP_TOSS_SECRET_KEY
# Set environment variables for React build
ENV REACT_APP_KAKAO_JS_KEY $REACT_APP_KAKAO_JS_KEY
ENV REACT_APP_KAKAO_REST_API_KEY $REACT_APP_KAKAO_REST_API_KEY
ENV REACT_APP_KAKAO_REDIRECT_URI $REACT_APP_KAKAO_REDIRECT_URI
ENV REACT_APP_BASE_URL $REACT_APP_BASE_URL
ENV REACT_APP_TOSS_CLIENT_KEY $REACT_APP_TOSS_CLIENT_KEY
ENV REACT_APP_TOSS_SECRET_KEY $REACT_APP_TOSS_SECRET_KEY
RUN npm run build
# Production stage
FROM nginx:stable-alpine
# nginx의 기본 설정을 삭제하고 앱에서 설정한 파일을 복사
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx
# 위 스테이지에서 생성한 빌드 결과를 nginx의 샘플 앱이 사용하던 폴더로 이동
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80
# nginx 실행
CMD [ "nginx", "-g", "daemon off;" ]