Browse Source

Fix Docker image build

pull/1162/head
Julian Simioni 7 years ago
parent
commit
713b236a87
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 8
      .circleci/docker.sh

8
.circleci/docker.sh

@ -6,17 +6,19 @@ DATE=`date +%Y-%m-%d`
DOCKER_REPOSITORY="pelias" DOCKER_REPOSITORY="pelias"
DOCKER_PROJECT="${DOCKER_REPOSITORY}/${CIRCLE_PROJECT_REPONAME}" DOCKER_PROJECT="${DOCKER_REPOSITORY}/${CIRCLE_PROJECT_REPONAME}"
BRANCH="$(echo $CIRCLE_BRANCH | tr '/' '-')" #slashes are not valid in docker tags. replace with dashes
# the name of the image that represents the "branch", that is an image that will be updated over time with the git branch # the name of the image that represents the "branch", that is an image that will be updated over time with the git branch
# the production branch is changed to "latest", otherwise the git branch becomes the name of the version # the production branch is changed to "latest", otherwise the git branch becomes the name of the version
if [[ "${CIRCLE_BRANCH}" == "production" ]]; then if [[ "${BRANCH}" == "production" ]]; then
DOCKER_BRANCH_IMAGE_VERSION="latest" DOCKER_BRANCH_IMAGE_VERSION="latest"
else else
DOCKER_BRANCH_IMAGE_VERSION="${CIRCLE_BRANCH/\//-}" #slashes are not valid in docker tags. replace with dashes DOCKER_BRANCH_IMAGE_VERSION="$BRANCH"
fi fi
DOCKER_BRANCH_IMAGE_NAME="${DOCKER_PROJECT}:${DOCKER_BRANCH_IMAGE_VERSION}" DOCKER_BRANCH_IMAGE_NAME="${DOCKER_PROJECT}:${DOCKER_BRANCH_IMAGE_VERSION}"
# the name of the image that represents the "tag", that is an image that is named with the date and git commit and will never be changed # the name of the image that represents the "tag", that is an image that is named with the date and git commit and will never be changed
DOCKER_TAG_IMAGE_VERSION="${CIRCLE_BRANCH}-${DATE}-${CIRCLE_SHA1}" DOCKER_TAG_IMAGE_VERSION="${BRANCH}-${DATE}-${CIRCLE_SHA1}"
DOCKER_TAG_IMAGE_NAME="${DOCKER_PROJECT}:${DOCKER_TAG_IMAGE_VERSION}" DOCKER_TAG_IMAGE_NAME="${DOCKER_PROJECT}:${DOCKER_TAG_IMAGE_VERSION}"
# build image and login to docker hub # build image and login to docker hub

Loading…
Cancel
Save