From 2cb1be52125eb76d157903953f2c91b849a10c63 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 2 Jun 2021 12:11:48 +0100 Subject: ci: Update run-docker scripts to work with Podman Not every Linux distro ships with Docker, and Podman is nicer. --- .gitlab-ci/run-docker.sh | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to '.gitlab-ci/run-docker.sh') diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh index ad73d3ba..6c03d8b0 100755 --- a/.gitlab-ci/run-docker.sh +++ b/.gitlab-ci/run-docker.sh @@ -1,11 +1,31 @@ #!/bin/bash +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 docker" +fi + set -e -TAG="registry.gitlab.gnome.org/gnome/gobject-introspection:v8" +REGISTRY="registry.gitlab.gnome.org/gnome/gobject-introspection" +TAG="${REGISTRY}:v8" -sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \ - --file "Dockerfile" . -sudo docker run --rm \ - --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \ - --tty --interactive "${TAG}" bash +${CMD} build \ + ${format} \ + --build-arg HOST_USER_ID="$UID" \ + --tag "${TAG}" \ + --file "Dockerfile" . +${CMD} run \ + --rm \ + --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \ + --tty --interactive \ + "${TAG}" \ + bash -- cgit v1.2.1