basket-service/deploy/image-build.sh
Piotr Biernat 005dbd53bc
Some checks failed
continuous-integration/drone/push Build is failing
Huge refactoring
2022-11-29 22:42:26 +01:00

32 lines
985 B
Bash
Executable File

#!/bin/sh
# RUN IN REPO ROOT DIR !!
export IMAGE_BASE="git.pbiernat.dev/egommerce/basket"
export SERVER_IMAGE="$IMAGE_BASE-svc"
export WORKER_IMAGE="$IMAGE_BASE-worker"
TARGET=${1:-latest}
KIND=${2:-all}
if [ $KIND = "svc" ] || [ $KIND = "all" ]; then
echo "Building: $SERVER_IMAGE:$TARGET"
if [ $TARGET = "dev" ]
then
docker build --rm --no-cache -t "$SERVER_IMAGE:$TARGET" -f Dockerfile.server . # >/dev/null 2>&1
else
docker build --rm --cache-from "$SERVER_IMAGE:$TARGET" -t "$SERVER_IMAGE:$TARGET" -f Dockerfile.server . >/dev/null 2>&1
fi
fi
if [ $KIND = "worker" ] || [ $KIND = "all" ]; then
echo "Building: $WORKER_IMAGE:$TARGET"
if [ $TARGET = "dev" ]
then
docker build --rm --no-cache -t "$WORKER_IMAGE:$TARGET" -f Dockerfile.worker . # >/dev/null 2>&1
else
docker build --rm --cache-from "$WORKER_IMAGE:$TARGET" -t "$WORKER_IMAGE:$TARGET" -f Dockerfile.worker . >/dev/null 2>&1
fi
fi
echo "Done."