This commit is contained in:
parent
c15e91cde8
commit
9453d61479
18
.gitea/workflows/buiildpublish.yaml
Normal file
18
.gitea/workflows/buiildpublish.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- name: Build the project
|
||||
run: |
|
||||
./build.sh
|
||||
- name: Publish
|
||||
run: |
|
||||
./publish.sh
|
||||
|
||||
|
14
build.sh
Executable file
14
build.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# iterate through the docker files in format Dockerfile.IMAGE_NAME
|
||||
for dockerfile in Dockerfile.*
|
||||
do
|
||||
# get the image name from the dockerfile
|
||||
image_name="${dockerfile//Dockerfile./}"
|
||||
# build the gitea.jde.nz/public/bb64:debian-curl docker image
|
||||
docker build -t "$image_name:latest" -f "$dockerfile" .
|
||||
done
|
||||
|
||||
|
24
publish.sh
24
publish.sh
@ -1,8 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# build the gitea.jde.nz/public/bb64:debian-curl docker image
|
||||
docker build -t gitea.jde.nz/public/debian-curl:latest -f Dockerfile .
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# get date/time in local timezone, format YYYY.MMDD.HHMMSS
|
||||
DATETIME=$(date +%Y.%m%d.%H%M%S)
|
||||
|
||||
"${SCRIPTDIR}/build.sh"
|
||||
|
||||
# iterate through the docker files in format Dockerfile.IMAGE_NAME
|
||||
for dockerfile in Dockerfile.*
|
||||
do
|
||||
# get the image name from the dockerfile
|
||||
image_name="${dockerfile//Dockerfile./}"
|
||||
# tag the image with the latest tag
|
||||
docker tag "$image_name:latest" "gitea.jde.nz/public/$image_name:latest"
|
||||
docker tag "$image_name:latest" "gitea.jde.nz/public/$image_name:$DATETIME"
|
||||
# push the image to the local docker registry
|
||||
docker push -a "gitea.jde.nz/public/$image_name"
|
||||
done
|
||||
|
||||
# push the gitea.jde.nz/public/bb64:debian-curl docker image to the gitea.jde.nz registry
|
||||
docker push gitea.jde.nz/public/debian-curl:latest
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user