Deployment
Creating a repository on Docker Hub allows you to store and distribute your Docker images. Docker Hub is a cloud-based registry service that enables you to share and manage your container images easily.
Create repository in dockerhub
- Log in to Docker Hub website using your Docker ID and password.
- After logging in, you will be directed to your Docker Hub dashboard. The dashboard provides an overview of your repositories, images, and other related information.
- To create a new repository, click on the
Create Repositorybutton, typically located on the top right corner of the dashboard. This will open a new repository creation page. - Choose a name and visibility
- On the repository creation page, enter a name for your repository. The name should be the same as your github repository.
- You can also choose the visibility of your repository, public or private. Public repositories can be accessed by anyone, while private repositories are only accessible to you and those you grant access. For all beaulieu related projects it is important to set this to private.
- You have the option to provide a description for your repository. The description can help others understand the purpose or contents of your images.
- Click on the
Createbutton.
Connect github to dockerhub
In the repository settings section, you can configure various options for your repository. Some of the key settings include:
- Tags: You can specify tags for your images, allowing users to easily differentiate between different versions or variants of your image.
- Builds: If you have your code hosted on a source code repository platform like GitHub or Bitbucket, you can set up automated builds to automatically build and update your Docker images whenever changes are pushed to your code repository.
- Webhooks: You can configure webhooks to trigger events or notifications based on specific activities within your repository.
The section that interests us is the Builds section
- Click on the
Buildstab. - Click on the
Link to Githubbutton. - In the Organization box select
BeaulieuCanada - In the
Select Repositorybox select your github repository - Leave the
AutotestandRepository Linkstooff - In the
Build rulessection there should be a default setup, we will use this default to setup our staging build- Source type: The type of source that will trigger the automated builds, use tag if you are versioning your repo otherwise leave it at branch
- Source: The source branch or tag for your automated build, if you are using branches use master for staging and production for production, if you are using tags it will be a regex, you can use this regex
/^v([0-9.]+)$/ - Docker Tag: The docker tag it will generate for the image. If your source is master this should be
staging, and if your source is production branch this should belatest(This is common docker practice). If your source is a tag you will want to generate a latest and a version at the same time you can do both by seperating with a comma like so:latest,v-{\1}wherev-{\1}will be the version from the source. - Dockerfile Location: The name of your docker file. Most times you can leave this at
Dockerfileif your docker build needs access to parent directories to build you need to specify in which folder to find the dockerfile ex.api/Dockerfile - Build Context: From what folder you will be building your docker image. In c# projects you will normally have a subfolder with the name of your project so you can input
/myprojectnamein Javascript/Typescript the dockerfile will always be in the root of the directory so you can leave this at/.
- Click on the
Savebutton - The end result should look like this:
or 
Your automatic image build is now setup you can proceed to the Portainer section
