GitHub Actions
You can use GitHub Actions 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 Secrets > Actions.
- Click on New repository secret.
- Enter
DEPLOY_TOKEN
as the name and paste the Deploy Token as the value. - Click Add secret.
Edit Workflow
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.
Complete Example
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.