pict-rs/docker/prod/build-image.sh

38 lines
698 B
Bash
Raw Normal View History

2020-06-15 19:20:25 +00:00
#!/usr/bin/env bash
function require() {
if [ "$1" = "" ]; then
echo "input '$2' required"
print_help
exit 1
fi
}
function print_help() {
echo "deploy.sh"
echo ""
echo "Usage:"
echo " deploy.sh [repo] [tag] [arch]"
echo ""
echo "Args:"
echo " repo: The docker repository to publish the image"
echo " tag: The tag applied to the docker image"
echo " arch: The architecuture of the doker image"
}
REPO=$1
TAG=$2
ARCH=$3
require "$REPO" repo
require "$TAG" tag
require "$ARCH" arch
sudo docker build \
2020-06-15 19:20:25 +00:00
--pull \
--build-arg TAG=$TAG \
2021-09-06 19:42:16 +00:00
--build-arg REPO_ARCH=$ARCH \
2020-06-15 19:20:25 +00:00
-t $REPO:$ARCH-$TAG \
2021-09-06 19:42:16 +00:00
-f Dockerfile \
2020-06-15 19:20:25 +00:00
.