34 lines
1014 B
Bash
34 lines
1014 B
Bash
|
#!/bin/sh
|
||
|
# RUN IN REPO ROOT DIR !!
|
||
|
|
||
|
# export DOCKER_BUILDKIT=1
|
||
|
|
||
|
export IMAGE_BASE="git.pbiernat.dev/egommerce/catalog"
|
||
|
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."
|