-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
145 additions
and
7 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
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,8 +1,120 @@ | ||
FROM node:18 | ||
RUN mkdir -p /var/app | ||
WORKDIR /var/app | ||
# FROM node:18 | ||
# RUN mkdir -p /var/app | ||
# WORKDIR /var/app | ||
# COPY . . | ||
# RUN npm install | ||
# RUN npm run build | ||
# EXPOSE 80 | ||
# CMD [ "node", "dist/main.js" ] | ||
|
||
|
||
# FROM node:19-alpine AS builder | ||
|
||
# WORKDIR /usr/src/app | ||
|
||
# COPY . . | ||
|
||
# RUN npm install | ||
# RUN npm run build | ||
|
||
# FROM node:19-alpine AS Release | ||
|
||
# WORKDIR /app | ||
|
||
# COPY --from=builder /usr/src/app/dist /app/dist | ||
|
||
# FROM nginx:latest | ||
|
||
# RUN rm /etc/nginx/conf.d/default.conf | ||
|
||
# COPY ./nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
# RUN rm -rf ./usr/share/nginx/html/* | ||
|
||
# COPY --from=Release /app/dist ./usr/share/nginx/html/ | ||
|
||
# EXPOSE 80 | ||
# EXPOSE 443 | ||
|
||
# ENTRYPOINT ["nginx", "-g", "daemon off;"] | ||
|
||
# Node.js 빌드를 위한 스테이지 | ||
# FROM node:19-alpine AS builder | ||
|
||
# WORKDIR /usr/src/app | ||
|
||
# COPY . . | ||
|
||
# RUN npm install | ||
# RUN npm run build | ||
|
||
# # Node.js 서버 실행을 위한 스테이지 | ||
# FROM node:19-alpine AS release | ||
|
||
# WORKDIR /app | ||
|
||
# COPY --from=builder /usr/src/app /app | ||
|
||
# # Nginx 설정을 위한 스테이지 | ||
# FROM nginx:latest | ||
|
||
# # 기존의 기본 Nginx 설정 제거 | ||
# RUN rm /etc/nginx/conf.d/default.conf | ||
|
||
# # 새로운 Nginx 설정 복사 | ||
# COPY ./nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
# # 정적 파일을 제공하는 폴더를 비우기 | ||
# RUN rm -rf /usr/share/nginx/html/* | ||
|
||
# # 정적 파일을 제공하는 폴더에 빌드된 파일 복사 | ||
# COPY --from=release /app/dist /usr/share/nginx/html/ | ||
|
||
# # Nginx가 80 및 443 포트를 노출하도록 설정 | ||
# EXPOSE 80 | ||
# EXPOSE 443 | ||
|
||
# # Node.js 애플리케이션을 백그라운드에서 실행하기 위한 명령 추가 | ||
# # CMD를 사용하여 Node.js 서버를 백그라운드에서 실행 | ||
# CMD ["node", "/app/dist/main.js"] & | ||
|
||
# # Nginx를 포그라운드에서 실행 | ||
# ENTRYPOINT ["nginx", "-g", "daemon off;"] | ||
# Node.js 빌드를 위한 스테이지 | ||
FROM node:19-alpine AS builder | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN npm install | ||
RUN npm run build | ||
|
||
# Node.js 서버 실행을 위한 스테이지 | ||
FROM node:19-alpine AS release | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /usr/src/app /app | ||
|
||
# Nginx 설정을 위한 스테이지 | ||
FROM nginx:latest | ||
|
||
# 기존의 기본 Nginx 설정 제거 | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
|
||
# 새로운 Nginx 설정 복사 | ||
COPY ./nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
# 정적 파일을 제공하는 폴더를 비우기 | ||
RUN rm -rf /usr/share/nginx/html/* | ||
|
||
# 정적 파일을 제공하는 폴더에 빌드된 파일 복사 | ||
COPY --from=release /app/dist /usr/share/nginx/html/ | ||
|
||
# Nginx가 80 및 443 포트를 노출하도록 설정 | ||
EXPOSE 80 | ||
CMD [ "node", "dist/main.js" ] | ||
EXPOSE 443 | ||
|
||
# Node.js와 Nginx를 동시에 실행하기 위한 방법으로 bash를 사용 | ||
CMD sh -c "node /app/dist/main.js & 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
server { | ||
listen 80; | ||
server_name api.siso-balance-game.com; | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
server { | ||
listen 443 ssl; | ||
server_name api.siso-balance-game.com; | ||
|
||
ssl_certificate /etc/letsencrypt/live/api.siso-balance-game.com/fullchain.pem; | ||
ssl_certificate_key /etc/letsencrypt/live/api.siso-balance-game.com/privkey.pem; | ||
|
||
root /usr/share/nginx/html; | ||
|
||
location / { | ||
proxy_pass http://localhost; # Assuming your NestJS app runs on port 3000 | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection 'upgrade'; | ||
proxy_set_header Host $host; | ||
proxy_cache_bypass $http_upgrade; | ||
} | ||
} |
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