leex279 commited on
Commit
f0ea22e
·
unverified ·
1 Parent(s): bffb8a2

Update docker.yaml (stable/main deployment)

Browse files

Exteneded the workflow/action to also deploy a stable release container

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