Skip to content

Commit

Permalink
feat: NGINX Dockerfile 및 docker compose 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kumsil1006 committed Nov 22, 2022
1 parent 52eea81 commit 1bb9a4e
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/CLIENT_BUILD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,20 @@ jobs:
push: true
tags: ghcr.io/kumsil1006/oao:oao-client
context: ./client

- name: Run Docker Compose on the Server
uses: appleboy/ssh-action@master
env:
TOKEN: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
with:
host: ${{ secrets.ANOTHER_HOST }}
username: ${{ secrets.ANOTHER_USERNAME }}
password: ${{ secrets.ANOTHER_PASSWORD }}
port: ${{ secrets.ANOTHER_PORT }}
envs: TOKEN
script: |
docker login https://ghcr.io -u kumsil1006 -p "$TOKEN"
cd project4
docker pull ghcr.io/kumsil1006/oao:oao-client
docker compose up -d
docker image prune
17 changes: 17 additions & 0 deletions .github/workflows/SERVER_BUILD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,20 @@ jobs:
context: ./server
push: true
tags: ghcr.io/kumsil1006/oao:oao-server

- name: Run Docker Compose on the Server
uses: appleboy/ssh-action@master
env:
TOKEN: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
with:
host: ${{ secrets.ANOTHER_HOST }}
username: ${{ secrets.ANOTHER_USERNAME }}
password: ${{ secrets.ANOTHER_PASSWORD }}
port: ${{ secrets.ANOTHER_PORT }}
envs: TOKEN
script: |
docker login https://ghcr.io -u kumsil1006 -p "$TOKEN"
cd project4
docker pull ghcr.io/kumsil1006/oao:oao-server
docker compose up -d
docker image prune
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.9"
services:
proxy:
image: "ghcr.io/kumsil1006/oao:oao-proxy"
ports:
- "${EXPOSE_PORT}:80"
restart: always
frontend:
image: "ghcr.io/kumsil1006/oao:oao-client"
restart: always
expose:
- "3000"
backend:
image: "ghcr.io/kumsil1006/oao:oao-server"
restart: always
expose:
- "8080"
4 changes: 4 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginx
COPY ./default.conf /etc/nginx/conf.d/default.conf

RUN apt-get update && apt-get install vim -y
22 changes: 22 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen 80;
location / {
proxy_pass http://frontend:3000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
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;
}
location /api {
rewrite ^/api(.*)$ $1 break;
proxy_pass http://backend:8080;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
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;
}
}

0 comments on commit 1bb9a4e

Please sign in to comment.