DigitalOcean
How-to
Push a container to the container registry
From the command line
Install doctl and authenticate with an API token. Note that you should configure which version you would like to install in the commands below.
cd ~
wget https://github.com/digitalocean/doctl/releases/download/v1.130.0/doctl-1.130.0-linux-amd64.tar.gz
tar xf ~/doctl-1.130.0-linux-amd64.tar.gz
sudo mv ~/doctl /usr/local/bin
Authenticate
doctl registry login
Tag the image
docker tag <my-image> registry.digitalocean.com/<my-registry>/<my-image>
Push the image
docker push registry.digitalocean.com/<my-registry>/<my-image>
From a CI pipeline
name: Build and publish on push
on:
push:
branches: [main]
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Build image
run: docker build -t {image_name} .
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Tag image with latest tag
run: docker tag streamlit registry.digitalocean.com/{registry_name}/{image_name}:latest
- name: Push image to DO Container Registry
run: docker push registry.digitalocean.com/{registry_name}/{image_name}:latest