-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added step to remove old images and containers at once
- Loading branch information
Showing
1 changed file
with
13 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,19 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Remove old Docker images | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
if docker inspect ${{ env.IMAGE_NAME }} >/dev/null 2>&1; then | ||
docker stop ${{ env.IMAGE_NAME }} | ||
docker rm ${{ env.IMAGE_NAME }} | ||
docker images --filter "reference=${{ env.IMAGE_NAME }}*" -q | xargs docker rmi -f || true | ||
fi | ||
- name: Build Docker image | ||
run: docker build -t ${{ env.IMAGE_NAME }}:${{ github.sha }} . | ||
|
||
|
@@ -35,10 +48,6 @@ jobs: | |
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
if docker inspect ${{ env.IMAGE_NAME }} >/dev/null 2>&1; then | ||
docker stop ${{ env.IMAGE_NAME }} | ||
docker rm ${{ env.IMAGE_NAME }} | ||
fi | ||
docker load -i ~/badging.tar | ||
docker run -d \ | ||
-p ${{ secrets.PORT }}:${{ secrets.PORT }} \ | ||
|