Skip to content

Commit b8c1392

Browse files
committed
๐Ÿ› fix: ์ž”์กด ๋ ˆ๊ฑฐ์‹œ ๊ฒฝ๋กœ ์ˆ˜์ •
1 parent 99888e0 commit b8c1392

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

โ€Ž.github/workflows/deploy_feed-crawler.ymlโ€Ž

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ permissions:
1111
packages: write
1212

1313
env:
14-
IMAGE_NAME: ghcr.io/${{ github.repository }}-feed-crawler
14+
IMAGE_NAME: ghcr.io/${{ github.repository }}/feed-crawler
1515
IMAGE_TAG: sha-${{ github.sha }}
16-
APP_ROOT: /var/web05-Denamu
1716
SERVICE: feed-crawler
1817
ENV_DIR: /var/prod_config/feed-crawler
1918
ENV_FILE: /var/prod_config/feed-crawler/.env.prod
@@ -38,7 +37,7 @@ jobs:
3837
uses: docker/build-push-action@v6
3938
with:
4039
context: ./feed-crawler
41-
file: ./feed-crawler/Dockerfile.prod
40+
file: ./feed-crawler/docker/Dockerfile.prod
4241
push: true
4342
tags: |
4443
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
@@ -50,6 +49,9 @@ jobs:
5049
runs-on: [self-hosted, prod]
5150
needs: build-and-push # Build ๋ฐ Push๊ฐ€ ๋๋‚˜๋ฉด ์‹œ์ž‘
5251
steps:
52+
- name: ์ฝ”๋“œ ์ฒดํฌ์•„์›ƒ
53+
uses: actions/checkout@v4
54+
5355
- name: GHCR ๋กœ๊ทธ์ธ (prod)
5456
uses: docker/login-action@v3
5557
with:
@@ -77,7 +79,6 @@ jobs:
7779
} | sudo tee "$ENV_FILE" >/dev/null
7880
7981
- name: Docker ์ด๋ฏธ์ง€ Pull & ์„œ๋น„์Šค ์žฌ์‹œ์ž‘
80-
working-directory: ${{ env.APP_ROOT }}
8182
run: |
8283
if docker compose version >/dev/null 2>&1; then DC="docker compose"; else DC="docker-compose"; fi
8384
docker pull "${IMAGE_NAME}:${IMAGE_TAG}" || true

โ€Ž.github/workflows/deploy_infra.ymlโ€Ž

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@ on:
88
- docker-compose/docker-compose.prod*.yml
99
workflow_dispatch:
1010

11+
env:
12+
COMPOSE_FILE: docker-compose/docker-compose.prod.yml
13+
1114
jobs:
1215
deployment:
13-
runs-on: ubuntu-latest
16+
runs-on: [self-hosted, prod]
1417
steps:
15-
# public ์„œ๋ฒ„๋กœ ssh ์ ‘์†
16-
- name: ssh connection
17-
uses: appleboy/[email protected]
18-
with:
19-
host: ${{ secrets.CLOUD_PUBLIC_INSTANCE_HOST }}
20-
username: ${{ secrets.CLOUD_PUBLIC_INSTANCE_USERNAME }}
21-
key: ${{ secrets.CLOUD_PUBLIC_INSTANCE_SSH_KEY }}
22-
port: ${{ secrets.CLOUD_PUBLIC_INSTANCE_PORT }}
23-
script: |
24-
cd /var/web05-Denamu
25-
git pull origin main
26-
docker-compose -f docker-compose/docker-compose.prod.yml down
27-
docker-compose -f docker-compose/docker-compose.prod.yml up -d
18+
- name: ์ฝ”๋“œ ์ฒดํฌ์•„์›ƒ
19+
uses: actions/checkout@v4
20+
21+
- name: ์ธํ”„๋ผ ์„œ๋น„์Šค ์žฌ์‹œ์ž‘
22+
run: |
23+
if docker compose version >/dev/null 2>&1; then DC="docker compose"; else DC="docker-compose"; fi
24+
$DC -f "$COMPOSE_FILE" down
25+
$DC -f "$COMPOSE_FILE" up -d
26+
docker image prune -f || true

โ€Ž.github/workflows/deploy_server.ymlโ€Ž

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ permissions:
1111
packages: write
1212

1313
env:
14-
IMAGE_NAME: ghcr.io/${{ github.repository }}-server
14+
IMAGE_NAME: ghcr.io/${{ github.repository }}/server
1515
IMAGE_TAG: sha-${{ github.sha }}
16-
APP_ROOT: /var/web05-Denamu
1716
SERVICE: app
1817
ENV_DIR: /var/prod_config/server
1918
ENV_FILE: /var/prod_config/server/.env.prod
@@ -38,7 +37,7 @@ jobs:
3837
uses: docker/build-push-action@v6
3938
with:
4039
context: ./server
41-
file: ./server/Dockerfile.prod
40+
file: ./server/docker/Dockerfile.prod
4241
push: true
4342
tags: |
4443
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
@@ -50,6 +49,9 @@ jobs:
5049
runs-on: [self-hosted, prod]
5150
needs: build-and-push # Build ๋ฐ Push๊ฐ€ ๋๋‚˜๋ฉด ์‹œ์ž‘
5251
steps:
52+
- name: ์ฝ”๋“œ ์ฒดํฌ์•„์›ƒ
53+
uses: actions/checkout@v4
54+
5355
- name: GHCR ๋กœ๊ทธ์ธ (prod)
5456
uses: docker/login-action@v3
5557
with:
@@ -86,7 +88,6 @@ jobs:
8688
} | sudo tee "$ENV_FILE" >/dev/null
8789
8890
- name: Docker ์ด๋ฏธ์ง€ Pull & ์„œ๋น„์Šค ์žฌ์‹œ์ž‘
89-
working-directory: ${{ env.APP_ROOT }}
9091
run: |
9192
if docker compose version >/dev/null 2>&1; then DC="docker compose"; else DC="docker-compose"; fi
9293
docker pull "${IMAGE_NAME}:${IMAGE_TAG}" || true

0 commit comments

Comments
ย (0)