2021-09-26 14:42:50 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-01-16 21:13:59 +01:00
|
|
|
CONTAINER_NAME="sc64builder"
|
|
|
|
|
|
|
|
docker ps | grep $CONTAINER_NAME > /dev/null
|
2021-12-10 17:36:30 +01:00
|
|
|
|
2022-01-16 21:13:59 +01:00
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
docker run \
|
|
|
|
-dt --rm \
|
|
|
|
--name $CONTAINER_NAME \
|
|
|
|
--user $(id -u):$(id -g) \
|
|
|
|
--mount type=bind,src="$(pwd)",target="/workdir" \
|
|
|
|
ghcr.io/polprzewodnikowy/sc64env:v1.2
|
2021-12-10 17:36:30 +01:00
|
|
|
fi
|
|
|
|
|
2022-01-16 21:13:59 +01:00
|
|
|
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
GIT_TAG=$(git describe --tags 2> /dev/null)
|
|
|
|
GIT_SHA=$(git rev-parse HEAD)
|
|
|
|
GIT_MESSAGE=$(git log -1 --pretty=format:%B)
|
2022-01-12 16:14:08 +01:00
|
|
|
|
2022-01-15 01:16:17 +01:00
|
|
|
if [ -t 1 ]; then
|
|
|
|
DOCKER_OPTIONS="-it"
|
|
|
|
fi
|
|
|
|
|
2022-01-16 21:13:59 +01:00
|
|
|
docker exec \
|
|
|
|
$DOCKER_OPTIONS \
|
|
|
|
-e GIT_BRANCH="$GIT_BRANCH" \
|
|
|
|
-e GIT_TAG="$GIT_TAG" \
|
|
|
|
-e GIT_SHA="$GIT_SHA" \
|
|
|
|
-e GIT_MESSAGE="$GIT_MESSAGE" \
|
|
|
|
$CONTAINER_NAME \
|
2021-11-10 02:05:51 +01:00
|
|
|
./build.sh $@
|