-
-
Notifications
You must be signed in to change notification settings - Fork 10
35 lines (32 loc) · 1.19 KB
/
container-build.yaml
File metadata and controls
35 lines (32 loc) · 1.19 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
name: "Container Build"
on:
workflow_dispatch: # needed for manually running this workflow
schedule:
- cron: "15 3 * * *" # sadly there is no TZ support here
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
container:
image: moby/buildkit:latest
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build container
run: |
# registry credentials
export DOCKER_CONFIG="$(pwd)/container"
echo "{\"auths\":{\"ghcr.io\":{\"auth\":\"$(echo -n ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | base64 -w 0)\"}}}" > $DOCKER_CONFIG/config.json
# ugly workaround for converting content of $GITHUB_REPOSITORY (= `MagicMirrorOrg/MagicMirror-3rd-Party-Modules`)
REPO="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
# build
buildctl-daemonless.sh build \
--progress plain \
--frontend=dockerfile.v0 \
--local context=. \
--local dockerfile=container \
--output type=image,"\"name=ghcr.io/${REPO}:${{ github.ref_name }}\",push=true"