Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Commit

Permalink
Andrey/docker buildx (#48)
Browse files Browse the repository at this point in the history
added docker buildx ARM build on a remote machine
  • Loading branch information
andreybavt authored Nov 17, 2022
1 parent 6c61cc6 commit 48608d9
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 17 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,49 @@ jobs:
with:
submodules: recursive

- name: Set up Docker Buildx
id: builder
uses: docker/setup-buildx-action@master

- name: "Append ARM buildx builder from AWS"
uses: baschny/append-buildx-action@v1
with:
builder: ${{ steps.builder.outputs.name }}
endpoint: ssh://${{ secrets.ARM_SSH_CONNECTION_STRING }}
ssh_private_key: ${{ secrets.ARM_SSH_PRIVATE_KEY }}


- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Build ML Worker image
env:
TAG: dev
run: make docker-build-nocache

- name: Login to Docker registry
uses: docker/login-action@v2
if: ${{ steps.extract_branch.outputs.branch == 'main' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push ML Worker image to Docker registry
if: ${{ steps.extract_branch.outputs.branch == 'main' }}
- name: Build and push
uses: docker/bake-action@master
env:
TAG: dev
run: make docker-push
with:
push: ${{ steps.extract_branch.outputs.branch == 'main' }}
set: |
*.platform=linux/amd64
*.platform=linux/arm64

- name: Invoke deployment hook
if: ${{ steps.extract_branch.outputs.branch == 'main' }}
run: |
curl -L --silent --max-time 900 ${{ secrets.TEST_SERVER_WEBHOOK_URL_BASE }}/redeploy-dev
curl -L --silent --max-time 900 ${{ secrets.TEST_SERVER_WEBHOOK_URL_BASE }}/redeploy-dev
- name: Remove containers and volumes
run: docker system prune -a -f
run: |
docker system prune -a -f
docker builder prune --force --keep-storage=10GB
32 changes: 25 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ jobs:
with:
submodules: recursive

- name: Set up Docker Buildx
id: builder
uses: docker/setup-buildx-action@master


- name: "Append ARM buildx builder from AWS"
uses: baschny/append-buildx-action@v1
with:
builder: ${{ steps.builder.outputs.name }}
endpoint: ssh://${{ secrets.ARM_SSH_CONNECTION_STRING }}
ssh_private_key: ${{ secrets.ARM_SSH_PRIVATE_KEY }}

- name: Set tag name
id: tag
run: |
Expand All @@ -33,11 +45,15 @@ jobs:
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}

- name: Build ML Worker image
run: make VERSION=${{ steps.tag.outputs.version }} docker-build-nocache

- name: Push ML Worker image to Docker registry
run: make VERSION=${{ steps.tag.outputs.version }} docker-push
- name: Build and push docker image
uses: docker/bake-action@master
env:
TAG: ${{ steps.tag.outputs.version }}
with:
push: ${{ steps.extract_branch.outputs.branch == 'main' }}
set: |
*.platform=linux/amd64
*.platform=linux/arm64
- name: Tag images as <latest>
if: ${{ steps.tag.outputs.name == steps.tag.outputs.latest_version }}
Expand All @@ -46,12 +62,14 @@ jobs:
TAG: ${{ steps.tag.outputs.version }}
run: docker tag "${IMAGE}":"${TAG}" "${IMAGE}":latest

- name: Push <latest> images to ECR
- name: Push <latest> images to Hub
if: ${{ steps.tag.outputs.name == steps.tag.outputs.latest_version }}
run: make VERSION=latest docker-push

- name: Invoke deployment hook
run: curl -L --silent --max-time 900 ${{ secrets.TEST_SERVER_WEBHOOK_URL_BASE }}/redeploy-prod

- name: Remove containers and volumes
run: docker system prune -a -f
run: |
docker system prune -a -f
docker builder prune --force --keep-storage=10GB
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.8"
services:
ml-worker:
image: 'docker.io/giskardai/ml-worker:${TAG-latest}'
hostname: giskard-embedded-docker-worker
build:
dockerfile: ./docker/Dockerfile
context: .

0 comments on commit 48608d9

Please sign in to comment.