tcpasters/oci/build-pasted.sh
Thorsten Schubert 762bf9ed8e
All checks were successful
continuous-integration/drone/push Build is passing
OCI compatible container configuration
2022-09-17 10:03:52 +02:00

39 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# shellcheck shell=bash
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright © 2022 Thorsten Schubert <tschubert@bafh.org>
set -eo pipefail
shopt -s nullglob
has() {
hash "$1" &>/dev/null
}
if has podman; then
RUNTIME=podman
else
RUNTIME=docker
fi
BRANCH=$(git branch --show-current)
IMAGE=betaco.de/strom/rust-tcpaste-pasted
$RUNTIME build \
--file=Containerfile.pasted \
--label=org.opencontainers.image.title="tcp-tcpaste-pasted" \
--label=org.opencontainers.image.authors="Thorsten Schubert <tschubert@bafh.org>" \
--label=org.opencontainers.image.licenses="AGPL-3.0" \
--label=org.opencontainers.image.url="https://betaco.de/strom/rust-tcpaste.git" \
--label=org.opencontainers.image.source="https://betaco.de/strom/rust-tcpaste/raw/branch/staging/oci/Containerfile.pasted" \
--label=org.opencontainers.image.created="$(date --rfc-3339=seconds)" \
--label=org.opencontainers.image.revision="$(git rev-parse HEAD)" \
--label=org.opencontainers.image.version="$(git describe --tags "$(git rev-list --tags --max-count=1)")-$(git rev-parse --short HEAD)" \
--build-arg="${PUID:-1000}" \
--build-arg="${PGID:-1000}" \
--tag="${IMAGE}:${BRANCH}" \
"$(git rev-parse --show-toplevel)"
$RUNTIME tag "${IMAGE}:${BRANCH}" "${IMAGE}:latest"