GitLab CI/CD
You can use GitLab CI/CD to automate the deployment of Docker containers with Docker Deploy API.
Save Secret
First, you need to save the Deploy Token as a secret in your repository. You need to be a collaborator or owner of the repository to do this.
- Go to your repository on GitHub.
- Click Settings.
- Click CI/CD.
- Scroll down to Variables and click Expand.
- Click Add variable.
- Enter
DEPLOY_TOKEN
as the Key. The Value is the Deploy Token you generated. - Make sure to check Mask variable and Protect variable.
- Click Add variable.
Edit .gitlab-ci.yml
Add the following to your .gitlab-ci.yml
file.