Sign inSign up

figaw/cci-dockerhub-demo

By figaw

•Updated about 7 years ago

Image
0

395

figaw/cci-dockerhub-demo repository overview

⁠CircleCI, Dockerhub Demo

A demo project using

  • GitHub as a repository manager with a write-protected master-branch and a PR-based workflow.
  • CircleCi to "validate a website." On success you're allowed to merge your pull-request.
  • Docker Hub automatically builds the latest master-branch and makes the image available.

⁠TODO

  • The Docker image should of course be tagged with a nice version.

⁠Steps to reproduce

⁠Create repository on Github
  1. Create a new repository on GitHub.
⁠Subscribe project to CircleCI
  1. Visit https://circleci.com⁠
  2. Under "Add Projects" find the new repository and click "Set Up Project".
  3. Click "Start Building"
⁠In your working directory
  1. Add config.yml to .circleci-folder with appropriate config, valdiation, build, test-images etc.
  2. git init
  3. git add .
  4. git commit -am "Initial commit"
  5. git remote add origin [email protected]:<repository>.git
  6. git push -u origin master
  7. Make a change to the repository and push to a ready/setup branch.
⁠Visit the CircleCI UI
  1. Go to https://circleci.com/gh/<username>/<repository> in a browser, you should have a job that's succeeded.

Otherwise keep making changes and pushing until you have a successful job; it registers as a ci/circleci: build status check on Github

⁠Visit your repository on GitHub
  1. Go to Settings -> Branches

  2. Add a Branch Protection Rule for the master branch, choose

    • Require status checks to pass before merging
      • Require branches to be up to date before merging
      • Select the ci/circleci: build status check
    • Include Administrators
  3. Click "Create."

⁠Add a Dockerfile
  1. Create a file called Dockerfile with your image build logic
  2. (Optional) Create a file called .dockerignore with a white/blacklist of all files that aren't relevant for your image
  3. Create a new commit, push this to a branch and create a pull-request. Don't merge it yet.
⁠Create a new repository on Docker Hub
  1. Go to https://hub.docker.com/⁠ and log in.
  2. Click "Create Repository"
  3. If you haven't already, link your GitHub to your Docker Hub.
  4. Give your new repository a name, and click "Create"

On your new repository, visit the "Builds" tab.

  1. Click on the "Link to GitHub" button.
  2. Select your organization and the repository you created earlier. Click "Save and Build."

    It'll do an empty build on Docker Hub, because our master-branch doesn't yet contain a Dockerfile.

  3. (On GitHub) Merge your pull-request to the master-branch.
  4. (On Docker Hub), A new build is triggered after a short while. (You may have to reload the page, to see the effect.)

After a little while your Docker Hub repository should be offering the latest image, the contents of the README.md on GitHub and the Dockerfile.

Tag summary

Content type

Image

Digest

Size

42.7 MB

Last updated

about 7 years ago

docker pull figaw/cci-dockerhub-demo