Update docker-image.yml #16
Workflow file for this run
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
name: Publish Docker image | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- 'main' | |
paths: | |
- '.github/workflows/**' | |
- 'Dockerfile' | |
- '.zshrc' | |
- 'extra_downloads.yml' | |
- 'extra_model_paths.yml' | |
- 'run_comfy' | |
tags: | |
- "v*.*.*" | |
workflow_dispatch: | |
jobs: | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3.0.0 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3.0.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3.3.2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Log in to Docker Hub | |
if: github.event_name != 'pull_request ' | |
uses: docker/login-action@v3.0.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata | |
id: docker_meta | |
uses: docker/metadata-action@v5.4.0 | |
with: | |
images: fcogomez/comfy-docker | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
- name: Free disk space | |
run: | | |
sudo swapoff -a | |
sudo rm -f /swapfile | |
sudo apt clean | |
docker image prune --all --force | |
df -h | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
df -h | |
- name: Build and push Docker image | |
id: docker_build | |
uses: docker/build-push-action@v5.1.0 | |
with: | |
platforms: linux/amd64 | |
builder: ${{ steps.buildx.outputs.name }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
- name: Show image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |