generated from jim60105/Dockerfile-template
-
Notifications
You must be signed in to change notification settings - Fork 9
133 lines (116 loc) · 4.11 KB
/
docker_publish.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: docker_publish
on:
push:
branches:
- "master"
tags:
- "v*"
schedule:
- cron: "0 7 * * 0" # 7:00 AM every Sunday
workflow_dispatch:
jobs:
docker-tag:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Checkout submodule
run: |
cd stable-diffusion-webui && \
git fetch --all --tags && \
git checkout tags/${{ github.ref_name }} -b ${{ github.ref_name }}
- name: Setup docker
id: setup
uses: ./.github/workflows/docker-reused-setup-steps
with:
CR_PAT: ${{ secrets.CR_PAT }}
tag: ${{ github.ref_name }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
target: final
tags: ${{ steps.setup.outputs.tags }}
labels: ${{ steps.setup.outputs.labels }}
build-args: |
VERSION=${{ github.ref_name }}
RELEASE=${{ github.run_number }}
platforms: linux/amd64
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/stable-diffusion-webui:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/stable-diffusion-webui:cache,mode=max
docker-dev:
runs-on: ubuntu-latest
if: (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'))
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Checkout submodule
run: |
cd stable-diffusion-webui && \
git fetch origin +refs/heads/*:refs/remotes/origin/* -v && \
git checkout -b dev origin/dev;
- name: Setup docker
id: setup
uses: ./.github/workflows/docker-reused-setup-steps
with:
CR_PAT: ${{ secrets.CR_PAT }}
tag: dev
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
target: final
tags: ${{ steps.setup.outputs.tags }}
labels: ${{ steps.setup.outputs.labels }}
build-args: |
VERSION=dev
RELEASE=${{ github.run_number }}
platforms: linux/amd64
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/stable-diffusion-webui:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/stable-diffusion-webui:cache,mode=max
docker-forge:
runs-on: ubuntu-latest
if: (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'))
# Runs one by one to reuse the docker layer cache
needs: docker-dev
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Checkout submodule
run: |
cd stable-diffusion-webui && \
git remote add forge https://github.com/lllyasviel/stable-diffusion-webui-forge && \
git fetch forge +refs/heads/*:refs/remotes/forge/* -v && \
git checkout -b main forge/main;
- name: Setup docker
id: setup
uses: ./.github/workflows/docker-reused-setup-steps
with:
CR_PAT: ${{ secrets.CR_PAT }}
tag: forge
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
target: final
tags: ${{ steps.setup.outputs.tags }}
labels: ${{ steps.setup.outputs.labels }}
build-args: |
VERSION=forge
RELEASE=${{ github.run_number }}
platforms: linux/amd64
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/stable-diffusion-webui:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/stable-diffusion-webui:cache,mode=max