2022-10-06 21:22:44 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# RUN IN REPO ROOT DIR !!
|
|
|
|
|
2022-11-29 22:42:26 +01:00
|
|
|
export IMAGE_BASE="git.pbiernat.dev/egommerce/basket"
|
|
|
|
export SERVER_IMAGE="$IMAGE_BASE-svc"
|
|
|
|
export WORKER_IMAGE="$IMAGE_BASE-worker"
|
2022-10-06 21:22:44 +02:00
|
|
|
|
2022-11-29 22:42:26 +01:00
|
|
|
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."
|