Skip to content

Upload Ersilia base image to DockerHub #60

Upload Ersilia base image to DockerHub

Upload Ersilia base image to DockerHub #60

name: Upload Ersilia base image to DockerHub
on:
workflow_run:
workflows: ["Tag to version"]
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
upload_ersilia_base_to_dockerhub:
strategy:
matrix:
build-version: ["v1", "v2"]
runs-on: ubuntu-latest
steps:
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
# log in to dockerhub
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Checkout persist credentials
uses: actions/checkout@master
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Get version
run: |
wget https://raw.githubusercontent.com/ersilia-os/ersilia/master/ersilia/_static_version.py
mv _static_version.py ersilia/.
- name: Copy Dockerfile to base directory
run: |
cp dockerfiles/model-deploy-${{ matrix.build-version }}/base/* .
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ersiliaos/base-${{ matrix.build-version }}
# Docker tags based on the following events/attributes
tags: |
type=raw,value=latest
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}