Skip to content

Build and Push Docker Images #12

Build and Push Docker Images

Build and Push Docker Images #12

name: Build and Push Docker Images
on:
push:
tags:
- 'v*'
workflow_dispatch:
env:
DOCKERHUB_USERNAME: onyxdotapp
jobs:
build-executor:
name: Build and Push Executor Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_USERNAME }}/python-executor-sci
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
- name: Build and push executor image
uses: docker/build-push-action@v5
with:
context: ./executor
file: ./executor/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-code-interpreter:
name: Build and Push Code Interpreter Image
runs-on: ubuntu-latest
needs: build-executor
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_USERNAME }}/code-interpreter
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
- name: Build and push code-interpreter image
uses: docker/build-push-action@v5
with:
context: ./code-interpreter
file: ./code-interpreter/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max