cleansing docker images
This commit is contained in:
26
.github/workflows/build.yml
vendored
26
.github/workflows/build.yml
vendored
@@ -46,6 +46,10 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Clean up containers
|
||||||
|
run: |
|
||||||
|
docker ps -aq | xargs docker rm -f
|
||||||
|
|
||||||
native-build:
|
native-build:
|
||||||
name: Native Linux Build
|
name: Native Linux Build
|
||||||
needs: detect-project
|
needs: detect-project
|
||||||
@@ -84,6 +88,10 @@ jobs:
|
|||||||
name: linux-binary
|
name: linux-binary
|
||||||
path: ${{ needs.detect-project.outputs.project-dir }}/target/x86_64-unknown-linux-gnu/release/${{ needs.detect-project.outputs.project-name }}
|
path: ${{ needs.detect-project.outputs.project-dir }}/target/x86_64-unknown-linux-gnu/release/${{ needs.detect-project.outputs.project-name }}
|
||||||
|
|
||||||
|
- name: Clean up containers
|
||||||
|
run: |
|
||||||
|
docker ps -aq | xargs docker rm -f
|
||||||
|
|
||||||
windows-cross:
|
windows-cross:
|
||||||
name: Windows Cross-Compile
|
name: Windows Cross-Compile
|
||||||
needs: detect-project
|
needs: detect-project
|
||||||
@@ -121,6 +129,10 @@ jobs:
|
|||||||
name: windows-binary
|
name: windows-binary
|
||||||
path: ${{ needs.detect-project.outputs.project-dir }}/target/x86_64-pc-windows-gnu/release/${{ needs.detect-project.outputs.project-name }}.exe
|
path: ${{ needs.detect-project.outputs.project-dir }}/target/x86_64-pc-windows-gnu/release/${{ needs.detect-project.outputs.project-name }}.exe
|
||||||
|
|
||||||
|
- name: Clean up containers
|
||||||
|
run: |
|
||||||
|
docker ps -aq | xargs docker rm -f
|
||||||
|
|
||||||
docker-build:
|
docker-build:
|
||||||
name: Build Linux Docker Image
|
name: Build Linux Docker Image
|
||||||
needs: [native-build, windows-cross, detect-project]
|
needs: [native-build, windows-cross, detect-project]
|
||||||
@@ -164,13 +176,7 @@ jobs:
|
|||||||
docker tag ${{ env.IMAGE_NAME }}:linux-${{ env.TAG }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:linux-${{ env.TAG }}
|
docker tag ${{ env.IMAGE_NAME }}:linux-${{ env.TAG }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:linux-${{ env.TAG }}
|
||||||
echo "Pushing Linux Docker image to registry: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:linux-${{ env.TAG }}"
|
echo "Pushing Linux Docker image to registry: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:linux-${{ env.TAG }}"
|
||||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:linux-${{ env.TAG }}
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:linux-${{ env.TAG }}
|
||||||
|
|
||||||
cleanup:
|
- name: Clean up containers
|
||||||
name: Cleanup
|
run: |
|
||||||
if: always()
|
docker ps -aq | xargs docker rm -f
|
||||||
needs: [docker-build, native-build, windows-cross]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Cleanup Docker images
|
|
||||||
if: contains(needs.*.result, 'failure')
|
|
||||||
run: docker system prune -a -f
|
|
Reference in New Issue
Block a user