Skip to content

Commit

Permalink
Delete containers and images related to tags
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasKnudsen committed Apr 10, 2024
1 parent 610686e commit 23095e2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/autoredeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ jobs:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Stop and remove containers by tag
- name: Stop and remove containers, then remove images
run: |
# Stop containers running from 'backend:outreach' image
docker ps -q --filter ancestor=backend:outreach | xargs -r docker stop
# Stop containers running from 'frontend:outreach' image
docker ps -q --filter ancestor=frontend:outreach | xargs -r docker stop
# Find and stop containers running from 'backend:outreach' image, then remove them
docker ps -aq --filter ancestor=backend:outreach | xargs -r docker stop | xargs -r docker rm
# Find and stop containers running from 'frontend:outreach' image, then remove them
docker ps -aq --filter ancestor=frontend:outreach | xargs -r docker stop | xargs -r docker rm
# Now, remove the images
docker rmi backend:outreach frontend:outreach || true
- name: Create .env files
run: |
# Create .env with all variables except HOST_URL Backend
Expand Down

0 comments on commit 23095e2

Please sign in to comment.