test #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: API Docker | |
on: | |
push: | |
branches: | |
- "poetry-docker" | |
concurrency: | |
group: api-docker-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
DIFY_API_IMAGE_NAME: ${{ vars.DIFY_API_IMAGE_NAME || 'langgenius/dify-api' }} | |
jobs: | |
api-docker: | |
runs-on: ${{ matrix.platform == 'linux/arm64' && 'arm64_runner' || 'ubuntu-latest' }} | |
if: github.repository == 'langgenius/dify' | |
strategy: | |
matrix: | |
include: | |
- platform: linux/amd64 | |
- platform: linux/arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ env.DOCKERHUB_USER }} | |
password: ${{ env.DOCKERHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.DIFY_API_IMAGE_NAME }} | |
tags: | | |
type=sha,enable=true,priority=100,prefix=poetry,suffix=-${{ matrix.platform }},format=long | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
push: false | |
context: ./api | |
file: ./api/poetry.Dockerfile | |
platforms: ${{ matrix.platform }} | |
build-args: COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
create-manifest: | |
needs: api-docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ env.DOCKERHUB_USER }} | |
password: ${{ env.DOCKERHUB_TOKEN }} | |
- name: Create and Push Docker Manifest | |
run: | | |
docker manifest create ${{ env.DIFY_API_IMAGE_NAME }}:poetry-${{ github.sha }} \ | |
${{ env.DIFY_API_IMAGE_NAME }}:${{ github.sha }}-linux/amd64 \ | |
${{ env.DIFY_API_IMAGE_NAME }}:${{ github.sha }}-linux/arm64 | |
docker manifest push ${{ env.DIFY_API_IMAGE_NAME }}:poetry-${{ github.sha }} |