twsl
commited on
ci: docker Image creation pipeline (#1011)
Browse files* Create docker.yaml
* Add build target
* Use build target var
* Use github token instead
.github/workflows/docker.yaml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
name: Docker Publish
|
3 |
+
|
4 |
+
on:
|
5 |
+
workflow_dispatch:
|
6 |
+
push:
|
7 |
+
branches:
|
8 |
+
- main
|
9 |
+
tags:
|
10 |
+
- v*
|
11 |
+
- "*"
|
12 |
+
|
13 |
+
env:
|
14 |
+
REGISTRY: ghcr.io
|
15 |
+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}
|
16 |
+
BUILD_TARGET: bolt-ai-production # bolt-ai-development
|
17 |
+
|
18 |
+
jobs:
|
19 |
+
docker-build-publish:
|
20 |
+
runs-on: ubuntu-latest
|
21 |
+
steps:
|
22 |
+
- name: Checkout
|
23 |
+
uses: actions/checkout@v4
|
24 |
+
|
25 |
+
- id: string
|
26 |
+
uses: ASzc/change-string-case-action@v6
|
27 |
+
with:
|
28 |
+
string: ${{ env.DOCKER_IMAGE }}
|
29 |
+
|
30 |
+
- name: Docker meta
|
31 |
+
id: meta
|
32 |
+
uses: crazy-max/ghaction-docker-meta@v5
|
33 |
+
with:
|
34 |
+
images: ${{ steps.string.outputs.lowercase }}
|
35 |
+
flavor: |
|
36 |
+
latest=true
|
37 |
+
prefix=
|
38 |
+
suffix=
|
39 |
+
tags: |
|
40 |
+
type=semver,pattern={{version}}
|
41 |
+
type=pep440,pattern={{version}}
|
42 |
+
type=ref,event=tag
|
43 |
+
type=raw,value={{sha}}
|
44 |
+
|
45 |
+
- name: Set up QEMU
|
46 |
+
uses: docker/setup-qemu-action@v3
|
47 |
+
|
48 |
+
- name: Set up Docker Buildx
|
49 |
+
uses: docker/setup-buildx-action@v3
|
50 |
+
|
51 |
+
- name: Login to Container Registry
|
52 |
+
uses: docker/login-action@v3
|
53 |
+
with:
|
54 |
+
registry: ${{ env.REGISTRY }}
|
55 |
+
username: ${{ github.actor }} # ${{ secrets.DOCKER_USERNAME }}
|
56 |
+
password: ${{ secrets.GITHUB_TOKEN }} # ${{ secrets.DOCKER_PASSWORD }}
|
57 |
+
|
58 |
+
- name: Build and push
|
59 |
+
uses: docker/build-push-action@v6
|
60 |
+
with:
|
61 |
+
context: .
|
62 |
+
file: ./Dockerfile
|
63 |
+
target: ${{ env.BUILD_TARGET }}
|
64 |
+
push: true
|
65 |
+
tags: ${{ steps.meta.outputs.tags }}
|
66 |
+
labels: ${{ steps.meta.outputs.labels }}
|
67 |
+
cache-from: type=registry,ref=${{ steps.string.outputs.lowercase }}:latest
|
68 |
+
cache-to: type=inline
|
69 |
+
|
70 |
+
- name: Check manifest
|
71 |
+
run: |
|
72 |
+
docker buildx imagetools inspect ${{ steps.string.outputs.lowercase }}:${{ steps.meta.outputs.version }}
|
73 |
+
|
74 |
+
- name: Dump context
|
75 |
+
if: always()
|
76 |
+
uses: crazy-max/ghaction-dump-context@v2
|