Committed by
GitHub
Add disk space cleanup step in CI workflow
Added a step to free up disk space before building the Docker image.
Showing
1 changed file
with
9 additions
and
7 deletions
| 1 | name: Docker Image CI | 1 | name: Docker Image CI |
| 2 | - | ||
| 3 | on: | 2 | on: |
| 4 | push: | 3 | push: |
| 5 | tags: | 4 | tags: |
| 6 | - 'v*' | 5 | - 'v*' |
| 7 | - | ||
| 8 | jobs: | 6 | jobs: |
| 9 | build_and_publish: | 7 | build_and_publish: |
| 10 | runs-on: ubuntu-latest | 8 | runs-on: ubuntu-latest |
| 11 | permissions: | 9 | permissions: |
| 12 | contents: read | 10 | contents: read |
| 13 | packages: write | 11 | packages: write |
| 14 | - | ||
| 15 | steps: | 12 | steps: |
| 16 | - name: Checkout repository | 13 | - name: Checkout repository |
| 17 | uses: actions/checkout@v4 | 14 | uses: actions/checkout@v4 |
| 18 | 15 | ||
| 16 | + - name: Free Disk Space | ||
| 17 | + run: | | ||
| 18 | + sudo rm -rf /usr/share/dotnet | ||
| 19 | + sudo rm -rf /usr/local/lib/android | ||
| 20 | + sudo rm -rf /opt/ghc | ||
| 21 | + sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
| 22 | + sudo docker image prune --all --force | ||
| 23 | + df -h | ||
| 24 | + | ||
| 19 | - name: Log in to the Container registry | 25 | - name: Log in to the Container registry |
| 20 | uses: docker/login-action@v3 | 26 | uses: docker/login-action@v3 |
| 21 | with: | 27 | with: |
| 22 | registry: ghcr.io | 28 | registry: ghcr.io |
| 23 | username: ${{ github.actor }} | 29 | username: ${{ github.actor }} |
| 24 | password: ${{ secrets.GITHUB_TOKEN }} | 30 | password: ${{ secrets.GITHUB_TOKEN }} |
| 25 | - | ||
| 26 | - name: Extract metadata (tags, labels) for Docker | 31 | - name: Extract metadata (tags, labels) for Docker |
| 27 | id: meta | 32 | id: meta |
| 28 | uses: docker/metadata-action@v5 | 33 | uses: docker/metadata-action@v5 |
| @@ -32,15 +37,12 @@ jobs: | @@ -32,15 +37,12 @@ jobs: | ||
| 32 | type=ref,event=tag | 37 | type=ref,event=tag |
| 33 | type=semver,pattern={{version}} | 38 | type=semver,pattern={{version}} |
| 34 | type=raw,value=latest | 39 | type=raw,value=latest |
| 35 | - | ||
| 36 | - name: Set up QEMU | 40 | - name: Set up QEMU |
| 37 | uses: docker/setup-qemu-action@v3 | 41 | uses: docker/setup-qemu-action@v3 |
| 38 | - | ||
| 39 | - name: Set up Docker Buildx | 42 | - name: Set up Docker Buildx |
| 40 | uses: docker/setup-buildx-action@v3 | 43 | uses: docker/setup-buildx-action@v3 |
| 41 | with: | 44 | with: |
| 42 | driver: docker-container | 45 | driver: docker-container |
| 43 | - | ||
| 44 | - name: Build and push Docker image | 46 | - name: Build and push Docker image |
| 45 | uses: docker/build-push-action@v5 | 47 | uses: docker/build-push-action@v5 |
| 46 | with: | 48 | with: |
-
Please register or login to post a comment