Skip to content

Commit

Permalink
chore: 백엔드 CD 스크립트 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
helenason committed Jul 23, 2024
1 parent abae4bd commit 87191be
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/backend-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,16 @@ jobs:
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker build -t ${{ secrets.DOCKERHUB_IMAGE_NAME }} .
docker tag ${{ secrets.DOCKERHUB_IMAGE_NAME }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:${GITHUB_SHA::7}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:${GITHUB_SHA::7}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:${GITHUB_SHA::7}
deploy:
needs: build-and-test
runs-on: self-hosted

steps:
- name: Pull Image And Restart Container
run: |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:${GITHUB_SHA::7}
docker stop ${{ secrets.DOCKERHUB_CONTAINER_NAME }} | true
docker rm ${{ secrets.DOCKERHUB_CONTAINER_NAME }} | true
docker run --name ${{ secrets.DOCKERHUB_CONTAINER_NAME }} -p 80:8080 ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:${GITHUB_SHA::7}

0 comments on commit 87191be

Please sign in to comment.