summaryrefslogtreecommitdiff
path: root/.gitlab-ci/run-docker-minimal.sh
blob: b090c5eb39c8860d177a059073844e308f7bb263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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

REGISTRY="registry.gitlab.gnome.org/gnome/gobject-introspection"
TAG="${REGISTRY}:min-v1"

${CMD} build \
        ${format} \
        --build-arg HOST_USER_ID="$UID" \
        --tag "${TAG}" \
        --file "minimal.Dockerfile" .

${CMD} run \
        --rm \
        --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
        --tty --interactive \
        "${TAG}" \
        bash