build 558 Bytes
Newer Older
1 2 3 4 5 6 7 8
#!/bin/bash

set -euo pipefail

REGISTRY="${REGISTRY:-}"

user='djds'
repo='autopsy'
bghost's avatar
bghost committed
9
tag="${1:-corretto}"
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

# set environment vars
GID="${GID:-$(id -g)}"
AUDIO="${AUDIO:-$(getent group audio | cut -d ':' -f 3)}"
ID="${ID:-$(id -u)}"

# build the container:
docker build \
    --build-arg GID="${GID}" \
    --build-arg ID="${ID}" \
    --build-arg AUDIO="${AUDIO}" \
    -t "${REGISTRY}${user}/${repo}:${tag}" .

if [[ "${PUSH:-}" == "true" ]]; then
    docker push "${REGISTRY}${user}/${repo}:${tag}"
fi

# clean up our host environment
unset {GID,ID,AUDIO}