Skip to content

Commit

Permalink
Updated YML to give Permission, and Give Tag when Push
Browse files Browse the repository at this point in the history
  • Loading branch information
zzunipark committed Jun 1, 2024
1 parent 5e93f01 commit 254f8ed
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
with:
arguments: clean bootJar

- name: tag docker image
run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/mindway-v2-backend ${{ secrets.DOCKERHUB_USERNAME }}/mindway-v2-backend:latest

- name: docker image build
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/mindway-v2-backend .

Expand All @@ -41,14 +44,25 @@ jobs:
needs: build-docker-image
runs-on: self-hosted
steps:
- name: Check current user
run: whoami

- name: Add user to Docker group
run: |
sudo usermod -aG docker $(whoami)
newgrp docker
- name: docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: docker pull
run: sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/mindway-v2-backend
- name: Check Docker login status
run: sudo docker info

- name: pull docker image with latest tag
run: sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/mindway-v2-backend:latest

- name: docker stop container
run: sudo docker stop $(sudo docker ps -q) 2> /dev/null || true
Expand Down

0 comments on commit 254f8ed

Please sign in to comment.