25 lines
877 B
Bash
Executable file
25 lines
877 B
Bash
Executable file
#!/bin/sh
|
|
|
|
case "$1" in
|
|
build)
|
|
docker pull $CI_REGISTRY_IMAGE:latest
|
|
docker build --cache-from $CI_REGISTRY_IMAGE:latest \
|
|
-t $CI_REGISTRY_IMAGE:ce-latest -t $CI_REGISTRY_IMAGE:ee-latest \
|
|
-t $CI_REGISTRY_IMAGE:ce-nightly -t $CI_REGISTRY_IMAGE:ee-nightly \
|
|
-t $CI_REGISTRY_IMAGE:latest .
|
|
;;
|
|
publish)
|
|
test -n "$CI_BUILD_TOKEN" || exit 1
|
|
docker login --username gitlab-ci-token --password $CI_BUILD_TOKEN registry.gitlab.com
|
|
docker push $CI_REGISTRY_IMAGE:latest
|
|
docker push $CI_REGISTRY_IMAGE:ce-latest
|
|
docker push $CI_REGISTRY_IMAGE:ee-latest
|
|
docker push $CI_REGISTRY_IMAGE:ee-nightly
|
|
docker push $CI_REGISTRY_IMAGE:ee-nightly
|
|
docker logout registry.gitlab.com
|
|
;;
|
|
*)
|
|
echo "Usage: $0 [build|publish]"
|
|
exit 1
|
|
;;
|
|
esac
|