blob: 629823b64e78fac4f16a162faf9591192b22f35b [file] [log] [blame]
Matthias Andreas Benkardc7eead92022-10-09 19:30:42 +02001#! /bin/bash
Matthias Andreas Benkarda9074952022-05-13 20:47:42 +02002# SPDX-FileCopyrightText: © 2022 Matthias Andreas Benkard <code@mail.matthias.benkard.de>
3#
4# SPDX-License-Identifier: GPL-3.0-or-later
5
6set -euo pipefail
7
8cd "$(dirname $(readlink -e "$0"))"
9
10image=docker.benkard.de/mulk/openjdk-runtime:latest
Matthias Andreas Benkarda534c6c2022-11-04 05:27:36 +010011dependencies=(registry.access.redhat.com/ubi9/ubi-micro:latest registry.access.redhat.com/ubi9/ubi-minimal:latest)
Matthias Andreas Benkarda9074952022-05-13 20:47:42 +020012use_kaniko=no
13
14./prepare
15
16if [[ "${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 Benkard0acc5892022-06-10 06:12:15 +020021 --image=registry.access.redhat.com/ubi9/ubi-micro:latest \
22 --image=registry.access.redhat.com/ubi9/ubi-minimal:latest
Matthias Andreas Benkarda9074952022-05-13 20:47:42 +020023
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
34else
Matthias Andreas Benkarda534c6c2022-11-04 05:27:36 +010035 for x in "${dependencies[@]}"; do
36 docker pull "$x"
37 done
Matthias Andreas Benkarda9074952022-05-13 20:47:42 +020038 docker build -t "${image}" .
39 docker push "${image}"
40fi