Skip to content

Commit

Permalink
chore: use watchtower
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryDorofeev committed Apr 24, 2024
1 parent 44b2df0 commit 795d77a
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,31 @@ jobs:
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Build Docker image
run: docker build -t dmitrydorofeev/godeploy:${GITHUB_SHA::8} .
run: docker build -t dmitrydorofeev/godeploy:${GITHUB_SHA::8} -t dmitrydorofeev/godeploy:latest .
- name: Push the image
run: docker push dmitrydorofeev/godeploy:${GITHUB_SHA::8}
run: |
docker push dmitrydorofeev/godeploy:${GITHUB_SHA::8}
docker push dmitrydorofeev/godeploy:latest
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: pull docker image
uses: appleboy/ssh-action@master
with:
envs: GITHUB_SHA
host: 37.139.41.28
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: sudo docker pull dmitrydorofeev/godeploy:${GITHUB_SHA::8}
- name: deploy docker image
uses: appleboy/ssh-action@master
with:
envs: GITHUB_SHA
host: 37.139.41.28
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: |
sudo docker rm -f $(sudo docker ps -aq)
sudo docker run -e VERSION=${GITHUB_SHA::8} -d -p 8080:8080 dmitrydorofeev/godeploy:${GITHUB_SHA::8}
# deploy:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: pull docker image
# uses: appleboy/ssh-action@master
# with:
# envs: GITHUB_SHA
# host: 37.139.41.28
# username: ubuntu
# key: ${{ secrets.PRIVATE_KEY }}
# script: sudo docker pull dmitrydorofeev/godeploy:${GITHUB_SHA::8}
# - name: deploy docker image
# uses: appleboy/ssh-action@master
# with:
# envs: GITHUB_SHA
# host: 37.139.41.28
# username: ubuntu
# key: ${{ secrets.PRIVATE_KEY }}
# script: |
# sudo docker rm -f $(sudo docker ps -aq)
# sudo docker run -e VERSION=${GITHUB_SHA::8} -d -p 8080:8080 dmitrydorofeev/godeploy:${GITHUB_SHA::8}

0 comments on commit 795d77a

Please sign in to comment.