2022-10-06 17:41:43 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# RUN IN REPO ROOT DIR !!
|
|
|
|
|
2022-11-30 02:22:50 +01:00
|
|
|
export IMAGE_NAME="git.pbiernat.dev/egommerce/api-gateway"
|
2022-12-06 06:16:56 +01:00
|
|
|
export BUILD_TIME=$(date +"%Y%m%d%H%M%S")
|
2022-10-06 17:41:43 +02:00
|
|
|
|
2022-10-12 17:51:29 +02:00
|
|
|
TARGET=${1:-latest}
|
|
|
|
|
|
|
|
echo "Building: $IMAGE_NAME:$TARGET"
|
|
|
|
if [ $TARGET = "dev" ]
|
|
|
|
then
|
2022-12-06 06:16:56 +01:00
|
|
|
docker build --build-arg BUILD_TIME --rm --no-cache -t "$IMAGE_NAME:dev" . # >/dev/null 2>&1
|
2022-10-12 17:51:29 +02:00
|
|
|
else
|
2022-12-06 06:16:56 +01:00
|
|
|
docker build --build-arg BUILD_TIME --rm --cache-from "$IMAGE_NAME:$TARGET" -t "$IMAGE_NAME:$TARGET" . >/dev/null 2>&1
|
2022-10-12 17:51:29 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Done."
|