feat(CI): Add pipeline to build images
All checks were successful
Image builder / build (push) Successful in 22s

This commit is contained in:
Tanguy Herbron 2023-08-07 11:25:07 +02:00
parent 7eea23921d
commit 590a9a5d78
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,23 @@
name: Image builder
on:
release:
types: [released]
push:
jobs:
build:
container:
image: git.halis.io/athens-school/runner-images:debian12.1-node18
runs-on: [arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to register
uses: https://gitea.com/docker/login-action@v2
with:
registry: https://git.halis.io
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_TOKEN }}
- name: Start shell build
run: ./build.sh

16
build.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
IMAGE_NAME=$(echo $GITHUB_SERVER_URL/$GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]' | cut -d '/' -f3-)
for d in ./images/*
do
for i in $d/*
do
echo "Building $i"
DISTRO=$(echo $i | cut -d '/' -f 3)
VERSION=$(echo $i | cut -d '/' -f 4 | cut -d '.' -f2-)
docker build -f $i . -t $IMAGE_NAME:$DISTRO$VERSION
docker push $IMAGE_NAME:$DISTRO$VERSION
done
done