Skip to content

Added autoscaler for the deployment. #28

Added autoscaler for the deployment.

Added autoscaler for the deployment. #28

Workflow file for this run

name: Docker Image CI
on:
push:
paths-ignore:
- build/base.Dockerfile
- .github/workflows/base-docker-image.yml
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Login to DigitalOcean Container Registry
uses: docker/login-action@v3
with:
registry: registry.digitalocean.com
username: ${{ secrets.DIGITALOCEAN_USERNAME }}
password: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- uses: actions/checkout@v3
- name: Download BlazeFace
uses: actions/checkout@v3
with:
repository: 'hollance/BlazeFace-PyTorch'
path: 'model/blazeface'
- name: Pull latest from DO
run: docker pull registry.digitalocean.com/thesmile/thesmile-base:latest
- name: Tag for local use
run: docker image tag registry.digitalocean.com/thesmile/thesmile-base:latest thesmile-base:latest
- name: Build the Docker image
run: docker build . --file build/Dockerfile --tag thesmile:$(date +%Y%m%d-%s) --tag thesmile:latest
- name: Tag for DO
run: docker image tag thesmile:latest registry.digitalocean.com/thesmile/thesmile:latest
- name: Tag sha for DO
run: docker image tag thesmile:latest registry.digitalocean.com/thesmile/thesmile:$(echo $GITHUB_SHA | head -c7)
- name: Push to DO
run: docker push registry.digitalocean.com/thesmile/thesmile:latest
- name: Push sha to DO
run: docker push registry.digitalocean.com/thesmile/thesmile:$(echo $GITHUB_SHA | head -c7)
- name: Update deployment file
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|registry.digitalocean.com/thesmile/thesmile:'${TAG}'|' $GITHUB_WORKSPACE/build/k8s/deployment.yaml
- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 smile-k8s-1-29-1-do-0-nyc3-1711943773962
- name: Set namespace
run: kubectl config set-context --current --namespace thesmile
- name: Deploy to DigitalOcean Kubernetes
run: kubectl apply -f $GITHUB_WORKSPACE/build/k8s/deployment.yaml
- name: Verify deployment
run: kubectl rollout status deployment/thesmile