mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-11 21:20:09 +00:00
ci: Update the docker wrapper script
Do a better job at detecting whether we have Docker installed.
This commit is contained in:
parent
d9608a0357
commit
7bc50b7466
@ -85,20 +85,25 @@ else
|
|||||||
base_version="v$base_version"
|
base_version="v$base_version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TAG="registry.gitlab.gnome.org/gnome/gtk/${base}:${base_version}"
|
if [ ! -x "$(command -v docker)" ] || [ docker --help |& grep -q podman ]; then
|
||||||
|
# Docker is actually implemented by podman, and its OCI output
|
||||||
|
# is incompatible with some of the dockerd instances on GitLab
|
||||||
|
# CI runners.
|
||||||
|
echo "Using: Podman"
|
||||||
|
format="--format docker"
|
||||||
|
CMD="podman"
|
||||||
|
else
|
||||||
|
echo "Using: Docker"
|
||||||
|
format=""
|
||||||
|
CMD="sudo socker"
|
||||||
|
fi
|
||||||
|
|
||||||
|
REGISTRY="registry.gitlab.gnome.org"
|
||||||
|
TAG="${REGISTRY}/gnome/gtk/${base}:${base_version}"
|
||||||
|
|
||||||
if [ $build == 1 ]; then
|
if [ $build == 1 ]; then
|
||||||
if docker --help |& grep -q podman; then
|
|
||||||
# Docker is actually implemented by podman, and its OCI output
|
|
||||||
# is incompatible with some of the dockerd instances on GitLab
|
|
||||||
# CI runners.
|
|
||||||
format="--format docker"
|
|
||||||
else
|
|
||||||
format=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
|
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
|
||||||
sudo docker build \
|
${CMD} build \
|
||||||
${format} \
|
${format} \
|
||||||
--build-arg HOST_USER_ID="$UID" \
|
--build-arg HOST_USER_ID="$UID" \
|
||||||
--tag "${TAG}" \
|
--tag "${TAG}" \
|
||||||
@ -110,16 +115,16 @@ if [ $push == 1 ]; then
|
|||||||
echo -e "\e[1;32mPUSHING\e[0m: ${base} as ${TAG}"
|
echo -e "\e[1;32mPUSHING\e[0m: ${base} as ${TAG}"
|
||||||
|
|
||||||
if [ $no_login == 0 ]; then
|
if [ $no_login == 0 ]; then
|
||||||
sudo docker login registry.gitlab.gnome.org
|
${CMD} login ${REGISTRY}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo docker push $TAG
|
${CMD} push ${TAG}
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $run == 1 ]; then
|
if [ $run == 1 ]; then
|
||||||
echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
|
echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
|
||||||
sudo docker run \
|
${CMD} run \
|
||||||
--rm \
|
--rm \
|
||||||
--volume "$(pwd)/..:/home/user/app" \
|
--volume "$(pwd)/..:/home/user/app" \
|
||||||
--workdir "/home/user/app" \
|
--workdir "/home/user/app" \
|
||||||
|
Loading…
Reference in New Issue
Block a user