-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (78 loc) · 2.27 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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@v4.1.2
- name: Setup QEMU
uses: docker/setup-qemu-action@v3.0.0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.2.0
- name: Cache Docker layers
uses: actions/cache@v4.0.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.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: docker_meta
uses: docker/metadata-action@v5.5.1
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.3.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 }}