variabilized build script, added makefile

make is good, make is life, use make
This commit is contained in:
Bryan Joshua Pedini 2024-04-18 15:43:37 +02:00
parent 8533c8bf5c
commit c5d7ae2e96
3 changed files with 20 additions and 3 deletions

7
.makeVars Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Copyright (c) 2024 Bryan Joshua Pedini
# License: MIT · see LICENSE file for more details
export REGISTRY=bryanpedini
export IMAGE=gobuilder

6
build.sh Normal file → Executable file
View File

@ -8,8 +8,8 @@ REGEX="^[ ]*(#.*)?$"
while read -r VERSION; do
if [[ ! "${VERSION}" =~ $REGEX ]]; then
docker pull golang:${VERSION}
docker build --force-rm --build-arg GO_VERSION=${VERSION} -t bryanpedini/gobuilder:${VERSION} .
docker push bryanpedini/gobuilder:${VERSION}
docker image rm bryanpedini/gobuilder:${VERSION} golang:${VERSION}
docker build --force-rm --build-arg GO_VERSION=${VERSION} -t ${REGISTRY}/${IMAGE}:${VERSION} .
docker push ${REGISTRY}/${IMAGE}:${VERSION}
docker image rm ${REGISTRY}/${IMAGE}:${VERSION} golang:${VERSION}
fi
done < versionlist

10
makefile Normal file
View File

@ -0,0 +1,10 @@
#!make
include .makeVars
# Copyright (c) 2024 Bryan Joshua Pedini
# License: MIT · see LICENSE file for more details
default: build
build:
bash -c "./build.sh"