|
| 1 | +name: Build AMD64 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + release: |
| 8 | + types: [published] |
| 9 | + |
| 10 | +env: |
| 11 | + DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} |
| 12 | + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} |
| 13 | + DIFY_SANDBOX_IMAGE_NAME: ${{ vars.DIFY_SANDBOX_IMAGE_NAME || 'langgenius/dify-sandbox' }} |
| 14 | + |
| 15 | +jobs: |
| 16 | + build_amd64: |
| 17 | + name: Build AMD64 |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Login to Docker Hub |
| 25 | + uses: docker/login-action@v2 |
| 26 | + with: |
| 27 | + username: ${{ env.DOCKERHUB_USER }} |
| 28 | + password: ${{ env.DOCKERHUB_TOKEN }} |
| 29 | + |
| 30 | + - name: Extract metadata (tags, labels) for Docker |
| 31 | + id: meta |
| 32 | + uses: docker/metadata-action@v5 |
| 33 | + with: |
| 34 | + images: ${{ env.DIFY_SANDBOX_IMAGE_NAME }} |
| 35 | + tags: | |
| 36 | + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} |
| 37 | + type=ref,event=branch |
| 38 | + type=sha,enable=true,priority=100,prefix=,suffix=,format=long |
| 39 | + type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }} |
| 40 | +
|
| 41 | + - name: Install System Dependencies |
| 42 | + run: sudo apt-get install -y pkg-config gcc libseccomp-dev |
| 43 | + |
| 44 | + - name: Set up Go |
| 45 | + uses: actions/setup-go@v4 |
| 46 | + with: |
| 47 | + go-version: 1.20.6 |
| 48 | + |
| 49 | + - name: Install dependencies |
| 50 | + run: go mod tidy |
| 51 | + |
| 52 | + - name: Run Build Binary |
| 53 | + run: bash ./build/build_amd64.sh |
| 54 | + |
| 55 | + - name: Run Build Docker Image |
| 56 | + run: docker build -t ${{ env.DIFY_SANDBOX_IMAGE_NAME }}:${{ steps.meta.outputs.tag }}-amd64 -f ./docker/amd64/dockerfile . |
| 57 | + |
| 58 | + - name: Run Push Docker Image |
| 59 | + run: docker push ${{ env.DIFY_SANDBOX_IMAGE_NAME }}:${{ steps.meta.outputs.tag }} |
0 commit comments