order-service/deploy/image-build.sh

32 lines
984 B
Bash
Raw Normal View History

2022-11-29 22:35:02 +01:00
#!/bin/sh
# RUN IN REPO ROOT DIR !!
export IMAGE_BASE="git.pbiernat.dev/egommerce/order"
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."