From 95ae5407990704d779ab72d63f1a87a5e6053b19 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 17 May 2020 10:19:54 +0200 Subject: [PATCH] Defined docker image to build in a var --- .travis.yml | 2 +- docker/build | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d9be39cd..8365f582 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,12 +31,12 @@ cache: before_install: - echo 'extension = apcu.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - phpenv config-rm xdebug.ini || return 0 - - if [[ "${DOCKER_PUBLISH}" == 'true' ]]; then sudo ./data/infra/ci/install-docker.sh ; fi - if [[ "${DOCKER_PUBLISH}" == 'false' ]]; then sudo ./data/infra/ci/install-ms-odbc.sh ; fi - if [[ "${DOCKER_PUBLISH}" == 'false' ]]; then docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_ms shlink_db shlink_db_postgres shlink_db_maria ; fi - if [[ "${DOCKER_PUBLISH}" == 'false' ]]; then yes | pecl install pdo_sqlsrv swoole-4.4.18 ; fi install: + - if [[ "${DOCKER_PUBLISH}" == 'true' ]]; then sudo ./data/infra/ci/install-docker.sh ; fi - if [[ "${DOCKER_PUBLISH}" == 'false' ]]; then composer self-update ; fi - if [[ "${DOCKER_PUBLISH}" == 'false' ]]; then composer install --no-interaction --prefer-dist ; fi diff --git a/docker/build b/docker/build index 5b639d50..8ac27d4d 100755 --- a/docker/build +++ b/docker/build @@ -4,6 +4,7 @@ set -e # PLATFORMS="linux/arm/v7,linux/arm64/v8,linux/amd64" PLATFORMS="linux/amd64" +DOCKER_IMAGE="shlinkio/shlink" BUILDX_VER=v0.4.1 export DOCKER_CLI_EXPERIMENTAL=enabled @@ -17,9 +18,9 @@ echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin # If there is a tag, regardless the branch, build that docker tag and also "stable" if [[ ! -z $TRAVIS_TAG ]]; then - TAGS="-t shlinkio/shlink:${TRAVIS_TAG#?}" + TAGS="-t ${DOCKER_IMAGE}:${TRAVIS_TAG#?}" # Push stable tag only if this is not an alpha or beta tag - [[ $TRAVIS_TAG != *"alpha"* && $TRAVIS_TAG != *"beta"* ]] && TAGS="${TAGS} -t shlinkio/shlink:stable" + [[ $TRAVIS_TAG != *"alpha"* && $TRAVIS_TAG != *"beta"* ]] && TAGS="${TAGS} -t ${DOCKER_IMAGE}:stable" docker buildx build --push \ --build-arg SHLINK_VERSION=${TRAVIS_TAG#?} \ @@ -30,5 +31,5 @@ if [[ ! -z $TRAVIS_TAG ]]; then elif [[ "$TRAVIS_BRANCH" == 'develop' ]]; then docker buildx build --push \ --platform ${PLATFORMS} \ - -t shlinkio/shlink:latest . + -t ${DOCKER_IMAGE}:latest . fi