30
loading...
This website collects cookies to deliver better user experience
git clone https://github.com/endalk200/prod-django-docker-config.git
doctl
is CLI for interacting with DigitalOcean APIs.
AuthToken
first. Go to your DigitalOcean dashboard, and click the API then Generate New Token Buttondoctl auth init
Validating token: OK
doctl registry login
docker build -t my-image-name:latest
my-image-name
After that, we are telling Docker to tag the version of this docker image latest
docker tag my-image-name:latest registry.digitalocean.com/my-registry1r43d/my-image-name:latest
docker push registry.digitalocean.com/my-registry1r43d/my-image-name:latest
.github/workflows
directory in you root project and create a file with the name of docker-image-build-push.yml
and put the following yml config in it.name: Build and push docker imageon:
push:
branches:
- release
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@main
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
- name: Build container image
run: docker build -t my-image-name:latest
- name: Log in to DigitalOcean Container Registry
run: doctl registry login --expiry-seconds 1200
- name: Tag the container being built
run: docker tag my-image-name:latest registry.digitalocean.com/my-registry1r43d/my-image-name:latest
- name: Push image to DigitalOcean Container Registry
run: docker push registry.digitalocean.com/my-registry1r43d/my-image-name:latest
spec.yml
name: my-project
services:
- name: my-project-image
image:
registry_type: "DOCR"
registry: "my-registry1r43d"
repository: "my-image-name"
tag: "latest"
run_command: start.sh server --worker-tmp-dir /dev/shm
envs:
- key: DEBUG
scope: RUN_AND_BUILD_TIME
value: "False"
http_port: 8080
instance_count: 1
instance_size_slug: basic-xs
routes:
- path: /
source_dir: /
doctl apps create --spec spec.yml