-
Notifications
You must be signed in to change notification settings - Fork 179
72 lines (61 loc) · 2.15 KB
/
docker-build-and-push.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
name: Build and Push Docker Images
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
isStableRelease:
type: boolean
description: "Is this a stable release? If this is true, the `latest` tag will be applied to the images."
required: true
default: false
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure all history and tags are fetched
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version and Create .meta file
run: |
echo "VERSION=$(git describe --tags --always)" >> $GITHUB_ENV
echo "BUILD=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "CISO_ASSISTANT_VERSION=$(git describe --tags --always)" > .meta
echo "CISO_ASSISTANT_BUILD=$(git rev-parse --short HEAD)" >> .meta
cp .meta ./backend/
cp .meta ./backend/ciso_assistant/
- name: Build and Push Frontend Docker Image
uses: docker/build-push-action@v6
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}/frontend:${{ env.VERSION }}
ghcr.io/${{ github.repository }}/frontend:latest
platforms: linux/amd64,linux/arm64,linux/arm64/v8
- name: Build and Push Backend Docker Image
uses: docker/build-push-action@v6
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}/backend:${{ env.VERSION }}
ghcr.io/${{ github.repository }}/backend:latest
platforms: linux/amd64,linux/arm64,linux/arm64/v8