Skip to content

Commit 1eb6b38

Browse files
authored
프로덕션 환경에서 문서화 파이프라인을 삭제한다. (#127)
* chore: add docker-compose files for each environment * chore: separate documentation workflows from production environments
1 parent 039e3c2 commit 1eb6b38

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

.github/workflows/deploy.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
build:
1313
name: Deploy API specification
1414
runs-on: ubuntu-latest
15+
if: github.ref_name == 'dev'
1516
environment: ${{ github.ref_name }}
1617
steps:
1718
- name: Checkout repository
@@ -95,7 +96,7 @@ jobs:
9596
host: ${{ secrets.EC2_HOST }}
9697
username: ${{ secrets.EC2_USER }}
9798
key: ${{ secrets.EC2_PRIVATE_KEY }}
98-
source: docker/docker-compose.yml
99+
source: docker/docker-compose-${{ github.ref_name }}.yml
99100
target: "~"
100101
strip_components: 1
101102
- name: Build and deploy container to AWS EC2
@@ -106,9 +107,12 @@ jobs:
106107
key: ${{ secrets.EC2_PRIVATE_KEY }}
107108
script: |
108109
aws secretsmanager get-secret-value --secret-id ${{ github.ref_name }}-env --region ap-northeast-2 --query SecretString --output text | jq -r '. | to_entries | map("\(.key)=\(.value)") | .[]' > .env
109-
aws s3 cp s3://${{ secrets.API_SPECIFICATION_BUCKET }}/api.yml .
110110
export IMAGE_URI=${{ secrets.ECR_REGISTRY }}/${{ secrets.ECR_REPOSITORY }}:${{ github.sha }}
111-
docker-compose --env-file .env up -d --build
111+
docker-compose -f docker-compose-${{ github.ref_name }}.yml --env-file .env up -d --build
112+
if [ "${{ github.ref_name }}" = "dev" ]; then
113+
aws s3 cp s3://${{ secrets.API_SPECIFICATION_BUCKET }}/api.yml .
114+
docker restart swagger
115+
fi
112116
notify-discord:
113117
name: Notify Discord
114118
runs-on: ubuntu-latest
@@ -127,7 +131,7 @@ jobs:
127131
"embeds": [
128132
{
129133
"title": "**${{ github.ref_name == 'prod' && '프로덕션' || '개발' }} 환경 배포 성공**",
130-
"description": "프로젝트가 성공적으로 배포되었습니다.",
134+
"description": "서버가 성공적으로 배포되었습니다.",
131135
"color": 3066993,
132136
"fields": [
133137
{

docker/docker-compose-local.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
- "name=redis"
1010
- "mode=standalone"
1111
mysql:
12-
image: mysql:8.4.3
12+
image: mysql
1313
container_name: mysql
1414
restart: always
1515
ports:

docker/docker-compose-prod.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
services:
2+
gotchai-server:
3+
image: ${IMAGE_URI}
4+
container_name: gotchai-server
5+
restart: always
6+
environment:
7+
- TZ=Asia/Seoul
8+
ports:
9+
- "8080:8080"
10+
depends_on:
11+
- redis
12+
env_file:
13+
- .env
14+
redis:
15+
image: redis:alpine
16+
container_name: redis
17+
ports:
18+
- "6379:6379"
19+
environment:
20+
- TZ=Asia/Seoul
21+
command: [ "redis-server", "--maxmemory", "64mb" ]

0 commit comments

Comments
 (0)