|
| 1 | +name: Build and Push Docker Images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + DOCKERHUB_USERNAME: onyxdotapp |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-executor: |
| 15 | + name: Build and Push Executor Image |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up Docker Buildx |
| 23 | + uses: docker/setup-buildx-action@v3 |
| 24 | + |
| 25 | + - name: Login to DockerHub |
| 26 | + uses: docker/login-action@v3 |
| 27 | + with: |
| 28 | + username: ${{ env.DOCKERHUB_USERNAME }} |
| 29 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 30 | + |
| 31 | + - name: Extract metadata |
| 32 | + id: meta |
| 33 | + uses: docker/metadata-action@v5 |
| 34 | + with: |
| 35 | + images: ${{ env.DOCKERHUB_USERNAME }}/python-executor-sci |
| 36 | + tags: | |
| 37 | + type=ref,event=branch |
| 38 | + type=ref,event=pr |
| 39 | + type=semver,pattern={{version}} |
| 40 | + type=semver,pattern={{major}}.{{minor}} |
| 41 | + type=semver,pattern={{major}} |
| 42 | + type=raw,value=latest,enable={{is_default_branch}} |
| 43 | +
|
| 44 | + - name: Build and push executor image |
| 45 | + uses: docker/build-push-action@v5 |
| 46 | + with: |
| 47 | + context: ./executor |
| 48 | + file: ./executor/Dockerfile |
| 49 | + push: true |
| 50 | + tags: ${{ steps.meta.outputs.tags }} |
| 51 | + labels: ${{ steps.meta.outputs.labels }} |
| 52 | + cache-from: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/python-executor-sci:buildcache |
| 53 | + cache-to: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/python-executor-sci:buildcache,mode=max |
| 54 | + |
| 55 | + build-code-interpreter: |
| 56 | + name: Build and Push Code Interpreter Image |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: build-executor |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Checkout code |
| 62 | + uses: actions/checkout@v4 |
| 63 | + |
| 64 | + - name: Set up Docker Buildx |
| 65 | + uses: docker/setup-buildx-action@v3 |
| 66 | + |
| 67 | + - name: Login to DockerHub |
| 68 | + uses: docker/login-action@v3 |
| 69 | + with: |
| 70 | + username: ${{ env.DOCKERHUB_USERNAME }} |
| 71 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 72 | + |
| 73 | + - name: Extract metadata |
| 74 | + id: meta |
| 75 | + uses: docker/metadata-action@v5 |
| 76 | + with: |
| 77 | + images: ${{ env.DOCKERHUB_USERNAME }}/code-interpreter |
| 78 | + tags: | |
| 79 | + type=ref,event=branch |
| 80 | + type=ref,event=pr |
| 81 | + type=semver,pattern={{version}} |
| 82 | + type=semver,pattern={{major}}.{{minor}} |
| 83 | + type=semver,pattern={{major}} |
| 84 | + type=raw,value=latest,enable={{is_default_branch}} |
| 85 | +
|
| 86 | + - name: Build and push code-interpreter image |
| 87 | + uses: docker/build-push-action@v5 |
| 88 | + with: |
| 89 | + context: ./code-interpreter |
| 90 | + file: ./code-interpreter/Dockerfile |
| 91 | + push: true |
| 92 | + tags: ${{ steps.meta.outputs.tags }} |
| 93 | + labels: ${{ steps.meta.outputs.labels }} |
| 94 | + cache-from: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/code-interpreter:buildcache |
| 95 | + cache-to: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/code-interpreter:buildcache,mode=max |
0 commit comments