-
Notifications
You must be signed in to change notification settings - Fork 54
42 lines (40 loc) · 1.33 KB
/
imagebuild_worker-ghcr.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
name: build-images-ghcr
run-name: Build Docker images (worker workflow) in the GitHub Container Registry
on:
workflow_call:
inputs:
image-tag:
required: true
type: string
jobs:
build-base:
runs-on: ubuntu-latest
steps:
- name: Print inputs
run: |
echo "image-tag: ${{ inputs.image-tag }}"
- name: Set timezone
run: sudo timedatectl set-timezone 'Europe/Athens'
- name: Get date
id: date
run: echo "push_date=$(date '+%H:%M@%d/%m/%Y')" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Base image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/gunet/openeclass:${{ inputs.image-tag }}
labels: gr.gunet.openeclass.pushdate=${{ steps.date.outputs.push_date }}
cache-from: type=registry,ref=ghcr.io/gunet/openeclass:buildcache
cache-to: type=registry,ref=ghcr.io/gunet/openeclass:buildcache,mode=max