Skip to content

Delete unused uploaded images #239

Delete unused uploaded images

Delete unused uploaded images #239

Workflow file for this run

name: Delete unused uploaded images
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
cleanupimages:
name: Clean up orphan images that are no longer used
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
name: id_lzm
key: ${{ secrets.LZM_SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.LZM_SSH_KNOWN_HOSTS }}
config: |
Host monitoring.localzero.net monitoring-test.localzero.net lzm
HostName monitoring.localzero.net
User monitoring
IdentityFile ~/.ssh/id_lzm
- name: Run clean up images command
shell: bash
run: |
ssh -tt monitoring.localzero.net /bin/bash << EOF
set -e
docker exec djangoapp-production python manage.py cleanupimages
exit
EOF