You can use GitHub Actions to automate the deployment of Docker containers with Docker Deploy API.
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 Secrets > Actions.
- Click on New repository secret.
DEPLOY_TOKENas the name and paste the Deploy Token as the value.
- Click Add secret.
Edit your workflow file (e.g.
.github/workflows/deploy.yml) and add the following content:
Make sure to replace
deploy.example.com with the URL of your Docker Deploy API instance.
This is a full example of a workflow file that builds a Docker image, pushes it to Docker Hub and deploys it using the Docker Deploy API.