-
Notifications
You must be signed in to change notification settings - Fork 8
53 lines (45 loc) · 1.58 KB
/
docker.yml
File metadata and controls
53 lines (45 loc) · 1.58 KB
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
name: Build and Push to GHCR
on:
push:
branches:
- stable
pull_request:
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Broncode kopiëren
uses: actions/checkout@v4
with:
fetch-depth: 0 # need full history to get refs & branch names reliably
- name: Docker BuildX instellen
uses: docker/setup-buildx-action@v3
- name: Get git info
id: gitinfo
run: |
# short commit and branch name
echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "branch_name=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
- name: Inloggen met GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: PolarLearn bouwen en pushen naar GHCR
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/polarlearn:latest
ghcr.io/${{ github.repository_owner }}/polarlearn:${{ steps.gitinfo.outputs.commit_hash }}
build-args: |
NEXT_PUBLIC_GITINF=${{ steps.gitinfo.outputs.commit_hash }}@${{ steps.gitinfo.outputs.branch_name }}
labels: |
org.opencontainers.image.revision=${{ steps.gitinfo.outputs.commit_hash }}
org.opencontainers.image.source=${{ github.repository }}
org.opencontainers.image.version=${{ github.ref_name }}