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 |
Matthias Andreas Benkard | a534c6c | 2022-11-04 05:27:36 +0100 | [diff] [blame] | 11 | dependencies=(registry.access.redhat.com/ubi9/ubi-micro:latest registry.access.redhat.com/ubi9/ubi-minimal:latest) |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 12 | use_kaniko=no |
| 13 | |
| 14 | ./prepare |
| 15 | |
| 16 | if [[ "${use_kaniko}" == yes ]]; then |
| 17 | docker run \ |
| 18 | --mount type=bind,src="$PWD",target=/workspace \ |
| 19 | gcr.io/kaniko-project/warmer:latest \ |
| 20 | --cache-dir=/workspace/cache \ |
Matthias Andreas Benkard | 0acc589 | 2022-06-10 06:12:15 +0200 | [diff] [blame] | 21 | --image=registry.access.redhat.com/ubi9/ubi-micro:latest \ |
| 22 | --image=registry.access.redhat.com/ubi9/ubi-minimal:latest |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 23 | |
| 24 | docker run \ |
| 25 | --mount type=bind,src="$PWD",target=/workspace \ |
| 26 | --mount type=bind,src="$HOME/.docker",target=/root/.docker,ro=true \ |
| 27 | gcr.io/kaniko-project/executor:latest \ |
| 28 | --dockerfile Dockerfile \ |
| 29 | --destination "${image}" \ |
| 30 | --context dir:///workspace/ \ |
| 31 | --cache=true \ |
| 32 | --cache-ttl=16800h0m0s \ |
| 33 | --reproducible=true |
| 34 | else |
Matthias Andreas Benkard | a534c6c | 2022-11-04 05:27:36 +0100 | [diff] [blame] | 35 | for x in "${dependencies[@]}"; do |
| 36 | docker pull "$x" |
| 37 | done |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 38 | docker build -t "${image}" . |
| 39 | docker push "${image}" |
| 40 | fi |