Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame^] | 1 | #! /bin/sh |
| 2 | # SPDX-FileCopyrightText: © 2022 Matthias Andreas Benkard <code@mail.matthias.benkard.de> |
| 3 | # |
| 4 | # SPDX-License-Identifier: GPL-3.0-or-later |
| 5 | |
| 6 | set -euo pipefail |
| 7 | |
| 8 | cd "$(dirname $(readlink -e "$0"))" |
| 9 | |
| 10 | image=docker.benkard.de/mulk/openjdk-runtime:latest |
| 11 | use_kaniko=no |
| 12 | |
| 13 | ./prepare |
| 14 | |
| 15 | if [[ "${use_kaniko}" == yes ]]; then |
| 16 | docker run \ |
| 17 | --mount type=bind,src="$PWD",target=/workspace \ |
| 18 | gcr.io/kaniko-project/warmer:latest \ |
| 19 | --cache-dir=/workspace/cache \ |
| 20 | --image=registry.access.redhat.com/ubi8/ubi-micro:latest \ |
| 21 | --image=registry.access.redhat.com/ubi8/ubi-minimal:latest |
| 22 | |
| 23 | docker run \ |
| 24 | --mount type=bind,src="$PWD",target=/workspace \ |
| 25 | --mount type=bind,src="$HOME/.docker",target=/root/.docker,ro=true \ |
| 26 | gcr.io/kaniko-project/executor:latest \ |
| 27 | --dockerfile Dockerfile \ |
| 28 | --destination "${image}" \ |
| 29 | --context dir:///workspace/ \ |
| 30 | --cache=true \ |
| 31 | --cache-ttl=16800h0m0s \ |
| 32 | --reproducible=true |
| 33 | else |
| 34 | docker build -t "${image}" . |
| 35 | docker push "${image}" |
| 36 | fi |