Skip to content

Commit 30fae76

Browse files
refactor: revert container build
1 parent 6c96cbb commit 30fae76

File tree

2 files changed

+27
-29
lines changed

2 files changed

+27
-29
lines changed

.github/workflows/container-build.yaml

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches:
99
- "main"
10+
- "develop"
1011

1112
permissions:
1213
contents: read
@@ -16,36 +17,30 @@ jobs:
1617
build:
1718
runs-on: ubuntu-latest
1819
timeout-minutes: 60
20+
container:
21+
image: moby/buildkit:latest
22+
options: --privileged
1923
steps:
2024
- name: Checkout code
2125
uses: actions/checkout@v5
22-
23-
- name: Derive image coordinates
24-
id: meta
26+
- name: Build container
2527
run: |
26-
set -euo pipefail
27-
repo="${GITHUB_REPOSITORY,,}"
28-
ref="${GITHUB_REF_NAME}"
29-
sanitized_ref=$(echo "${ref}" | tr '[:upper:]' '[:lower:]' | sed 's#[^a-z0-9_.-]#-#g')
30-
echo "image=ghcr.io/${repo}:${sanitized_ref}" >> "$GITHUB_OUTPUT"
31-
32-
- name: Set up Docker Buildx
33-
uses: docker/setup-buildx-action@v3
34-
35-
- name: Log in to GitHub Container Registry
36-
uses: docker/login-action@v3
37-
with:
38-
registry: ghcr.io
39-
username: ${{ github.actor }}
40-
password: ${{ secrets.GITHUB_TOKEN }}
41-
42-
- name: Build and push image
43-
uses: docker/build-push-action@v6
44-
with:
45-
context: .
46-
file: container/Dockerfile
47-
push: true
48-
platforms: linux/amd64
49-
build-args: |
50-
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
51-
tags: ${{ steps.meta.outputs.image }}
28+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
29+
# ugly workaround for converting content of $GITHUB_REPOSITORY (= `MagicMirrorOrg/MagicMirror-3rd-Party-Modules`)
30+
REPO="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
31+
# regular build
32+
PARAMS="--output type=image,\"name=ghcr.io/${REPO}:${{ github.ref_name }}\",push=true"
33+
else
34+
# only build with small wiki list and no image push
35+
PARAMS="--output type=image,push=false --opt build-arg:WIKI_FILE=website/test/3rd-Party-Modules.md"
36+
fi
37+
# registry credentials
38+
export DOCKER_CONFIG="$(pwd)/container"
39+
echo "{\"auths\":{\"ghcr.io\":{\"auth\":\"$(echo -n ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | base64 -w 0)\"}}}" > $DOCKER_CONFIG/config.json
40+
# build
41+
buildctl-daemonless.sh build \
42+
--progress plain \
43+
--frontend=dockerfile.v0 \
44+
--local context=. \
45+
--local dockerfile=container \
46+
$PARAMS

cspell.config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
"axios",
1111
"bergfex",
1212
"bugsounet",
13+
"buildctl",
1314
"checkjs",
1415
"checkts",
1516
"codeberg",
1617
"Cutover",
18+
"daemonless",
1719
"depandabot",
1820
"dependencie",
1921
"diffing",
@@ -40,6 +42,7 @@
4042
"NOASSERTION",
4143
"omxplayer",
4244
"openweathermap",
45+
"pipefail",
4346
"ptrbld",
4447
"ratp",
4548
"refspecs",

0 commit comments

Comments
 (0)