-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.56 KB
/
build-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
name: Create and publish a Docker image
on:
push:
branches:
- "main"
- "test"
jobs:
docker-build:
runs-on: ubuntu-latest
strategy:
matrix:
cuda_version: [12.1.0, 12.4.0]
env:
IMAGE_NAME: ${{ github.repository }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: Adjutment docker volumes
run: |
docker system df
docker system prune -a --volumes -f
docker system df
df
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
build-args: CUDA_VERSION=${{ matrix.cuda_version }}
tags: |
${{ github.repository }}:${{ matrix.cuda_version }}-${{ env.SHORT_SHA }}
${{ github.repository }}:${{ matrix.cuda_version }}-latest
cache-from: type=registry,ref=${{ github.repository }}:cache-${{ matrix.cuda_version }}
cache-to: type=registry,ref=${{ github.repository }}:cache-${{ matrix.cuda_version }},mode=max
generate-redoc:
runs-on: ubuntu-latest
needs: docker-build # このジョブはdocker-buildが完了した後に実行されます
steps:
- name: checkout
uses: actions/checkout@v2
- name: Run Docker container
run: |
docker run -d -p 7680:7680 --name sd-forge-container -e ARGS="--listen --enable-insecure-extension-access --port 7680 --nowebui --api --always-cpu --skip-torch-cuda-test --skip-install" sammrai/sd-forge-docker:latest
sleep 30 # Adjust if necessary, based on how long it takes the app to initialize
- name: Download openapi.json
run: |
curl -o openapi.json http://localhost:7680/openapi.json
- name: Install Redoc CLI
run: |
npm install -g redoc-cli
- name: Generate Redoc HTML
run: |
redoc-cli bundle openapi.json --output openapi.html
- name: Upload Redoc HTML as an artifact
uses: actions/upload-artifact@v3
with:
name: openapi-redoc
path: openapi.html
- name: Clean up Docker container
run: |
docker stop sd-forge-container
docker rm sd-forge-container