-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure github action to build images
- Loading branch information
1 parent
5c1e96f
commit 55e09c7
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
for image in $(ls images); do | ||
echo "Building $image" | ||
./.github/scripts/build-image.sh $image | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
IMAGE=$1 | ||
RELEASE=$(./images/${IMAGE}/latest.sh) | ||
VERSION=${RELEASE%%_*} | ||
VERSION=${VERSION#release-} | ||
VERSION=${VERSION#v} | ||
|
||
if [[ -z $VERSION ]]; then | ||
echo "Failed to retrieve latest version for $IMAGE" | ||
else | ||
docker buildx build \ | ||
--push \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--tag ghcr.io/hadrienpatte/${IMAGE}:${VERSION} \ | ||
--tag ghcr.io/hadrienpatte/${IMAGE}:latest \ | ||
--build-arg RELEASE=${RELEASE} \ | ||
--build-arg VERSION=${VERSION} \ | ||
--build-arg GOLANG_VERSION="1.20" \ | ||
--build-arg CHISEL_VERSION="v0.9.1" \ | ||
--label "org.opencontainers.image.authors=HadrienPatte" \ | ||
--label "org.opencontainers.image.source=https://github.com/HadrienPatte/images" \ | ||
--label "org.opencontainers.image.version=${VERSION}" \ | ||
--label "org.opencontainers.image.vendor=HadrienPatte" \ | ||
--label "org.opencontainers.image.title=${IMAGE}" \ | ||
- < images/${IMAGE}/Dockerfile | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
on: | ||
push: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
generate-images-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
images-matrix: ${{ steps.generate-images-matrix.outputs.images-matrix }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Generate images matrix | ||
run: echo "images-matrix={\"images\": [$(ls -mQ images)]}" | tee $GITHUB_OUTPUT | ||
build-images: | ||
runs-on: ubuntu-latest | ||
needs: generate-images-matrix | ||
strategy: | ||
matrix: | ||
image: ${{ fromJSON(needs.generate-images-matrix.outputs.images-matrix).images }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Github container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run build script | ||
run: ./.github/scripts/build-image.sh ${{ matrix.image }} |