Matthias Andreas Benkard | c7eead9 | 2022-10-09 19:30:42 +0200 | [diff] [blame^] | 1 | #! /bin/bash |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 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 \ |
Matthias Andreas Benkard | 0acc589 | 2022-06-10 06:12:15 +0200 | [diff] [blame] | 20 | --image=registry.access.redhat.com/ubi9/ubi-micro:latest \ |
| 21 | --image=registry.access.redhat.com/ubi9/ubi-minimal:latest |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 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 |