-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
10 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,25 @@ | ||
# Stage 1: Build the React app | ||
FROM node:lts AS build | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json package-lock.json ./ | ||
COPY package.json . | ||
|
||
RUN npm install | ||
RUN npm i | ||
|
||
COPY . . | ||
|
||
RUN npm run build | ||
|
||
# Stage 2: Serve with Nginx | ||
FROM nginx:stable-alpine | ||
|
||
# Remove default Nginx configuration and copy custom config | ||
# nginx의 기본 설정을 삭제하고 앱에서 설정한 파일을 복사 | ||
RUN rm -rf /etc/nginx/conf.d | ||
COPY conf /etc/nginx | ||
|
||
# Copy built files to Nginx | ||
# 위 스테이지에서 생성한 빌드 결과를 nginx의 샘플 앱이 사용하던 폴더로 이동 | ||
COPY --from=build /app/build /usr/share/nginx/html | ||
|
||
# Expose HTTP port | ||
EXPOSE 80 | ||
|
||
# Run Nginx | ||
CMD ["nginx", "-g", "daemon off;"] | ||
# nginx 실행 | ||
CMD [ "nginx", "-g", "daemon off;" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
server { | ||
listen 80; | ||
server_name syluv.store www.syluv.store; | ||
|
||
location / { | ||
proxy_pass http://localhost:3000; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} | ||
} |