Skip to content

Commit

Permalink
chore: 도커허브에 올라간 이미지를 재배포하는 워크플로우 추가 (#56)
Browse files Browse the repository at this point in the history
* chore: deploy 전용 워크플로우 작성

* fix: 오타 수정
  • Loading branch information
uwoobeat authored Feb 11, 2024
1 parent 49a9575 commit 8796e8f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/develop_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy to Develop

on:
workflow_dispatch:
inputs:
commit_hash:
description: 'commit_hash'
required: true

jobs:
deploy:
runs-on: ubuntu-latest
environment: develop
steps:
- name: Deploy to EC2 Server
uses: appleboy/ssh-action@master
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_IMAGE_TAG: ${{ github.event.inputs.commit_hash }}
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
envs: DOCKERHUB_USERNAME,DOCKERHUB_IMAGE_TAG # docker-compose.yml 에서 사용할 환경 변수
script: |
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
docker pull ${{ env.DOCKERHUB_USERNAME }}/gdsc-server:${{ env.DOCKERHUB_IMAGE_TAG }}
docker compose -f /home/ubuntu/docker-compose.yml up -d
docker image prune -a -f

0 comments on commit 8796e8f

Please sign in to comment.