This tutorial assumes you have created a repo using the instructions from #30. The sample Java repo that Semaphore creates actually has built-in functionality to spin the project to DockerHub. All you need to do is follow the steps outlined in the READ_ME file of the repo, which I have copied here and modified slightly.
CI/CD pipeline on Semaphore
The Semaphore pipeline is configured to:
Build the project
Run tests
Build Docker image
Push image to hub.docker.com
Semaphore pipeline configuration is located at .semaphore/semaphore.yml, in your project's repo.
Setting up
To set up this pipeline on your Semaphore account:
If you don't have sem command line tool installed, do so using curl https://storage.googleapis.com/sem-cli-releases/get.sh | bash and then connect to your account using sem connect <your organization>.semaphoreci.com <your private API token>. You can get the private token from your account dashboard at me.semaphoreci.com/account.
Be sure to clone the repo to your local device, if you haven't already, and navigate into that folder from the command line.
This pipeline relies on public Docker repository to push artifacts of successful builds. Create an account on https://hub.docker.com/ if you don't have one.
Add your hub.docker.com credentials to ./docker-hub-secret.yml, at the root of the repo. The credentials should remain private, so don't publish them to your Git repository by mistake.
Add your ./docker-hub-secret.yml credentials to Semaphore with sem create -f docker-hub-secret.yml
After pushing a new commit to the master branch, Semaphore will initiate a workflow, which you can examine by returning to your Semaphore dashboard and selecting the project name:
Once the pipeline runs, you'll be able to see the results from the workflow details page, which should look something like this:
How to Spin a Semaphore Project to DockerHub
This tutorial assumes you have created a repo using the instructions from #30. The sample Java repo that Semaphore creates actually has built-in functionality to spin the project to DockerHub. All you need to do is follow the steps outlined in the READ_ME file of the repo, which I have copied here and modified slightly.
CI/CD pipeline on Semaphore
The Semaphore pipeline is configured to:
hub.docker.com
Semaphore pipeline configuration is located at
.semaphore/semaphore.yml
, in your project's repo.Setting up
To set up this pipeline on your Semaphore account:
sem
command line tool installed, do so usingcurl https://storage.googleapis.com/sem-cli-releases/get.sh | bash
and then connect to your account usingsem connect <your organization>.semaphoreci.com <your private API token>
. You can get the private token from your account dashboard at me.semaphoreci.com/account.https://hub.docker.com/
if you don't have one.hub.docker.com
credentials to./docker-hub-secret.yml
, at the root of the repo. The credentials should remain private, so don't publish them to your Git repository by mistake../docker-hub-secret.yml
credentials to Semaphore withsem create -f docker-hub-secret.yml
After pushing a new commit to the
master
branch, Semaphore will initiate a workflow, which you can examine by returning to your Semaphore dashboard and selecting the project name:Once the pipeline runs, you'll be able to see the results from the workflow details page, which should look something like this: