Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Setup automated build on DockerHub #26

Open
1 task done
ibnesayeed opened this issue Oct 27, 2017 · 0 comments
Open
1 task done

Setup automated build on DockerHub #26

ibnesayeed opened this issue Oct 27, 2017 · 0 comments

Comments

@ibnesayeed
Copy link
Contributor

ibnesayeed commented Oct 27, 2017

Hey there, thank you for submitting an issue!

We are trying to keep issues for feature requests and bug reports. Please
complete the following checklist before creating a new one:

  • feature request

Currently, images are build from inside the Circle CI and pushed to the DockerHub. This requires the CI system to install docker client as well as have access to the DockerHub credentials. An alternate approach would be to use the Automated Builds feature of DockerHub or Docker Cloud (both are free for public images). This setup can clean the following blocks from the .circleci/config.yml file:

      - run:
          name: Install Docker client
          command: |
            if [ $CIRCLE_BRANCH = 'master' ]; then
              set -x
              VER="17.03.0-ce"
              curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
              tar -xz -C /tmp -f /tmp/docker-$VER.tgz
              mv /tmp/docker/* /usr/bin
            fi
      - run:
          name: Publish to Docker Hub
          command: |
            if [ $CIRCLE_BRANCH = 'master' ]; then
              TAG=0.1.$CIRCLE_BUILD_NUM
              docker build -t datatogether/coverage:latest -t datatogether/coverage:$TAG .
              docker login -u $DOCKER_USER -p $DOCKER_PASS
              docker push datatogether/coverage:$TAG
              docker push datatogether/coverage:latest
            fi

The following image illustrates an automated build setup that would:

  • build an image with master tag on every single commit to the master branch and
  • build two images latest and {release-tag} every time a release is tagged (using GitHub's Releases feature)

This way, the latest tag is always pointing to a stable build while keeping a history of all releases along with bleeding edge master image.

docker-auto-build-settings

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant