|
1 | 1 | name: latent-to-image-docker-cd |
2 | 2 | on: |
| 3 | + pull_request: |
3 | 4 | push: |
4 | 5 | branches: |
5 | 6 | - main |
6 | 7 | paths: |
7 | 8 | - "docker_images/latent-to-image/**" |
8 | 9 | jobs: |
9 | 10 | build: |
10 | | - runs-on: ubuntu-latest |
| 11 | + runs-on: |
| 12 | + group: aws-general-8-plus-priv |
11 | 13 | steps: |
12 | 14 | - name: Set up Python ${{ matrix.python-version }} |
13 | 15 | uses: actions/setup-python@v2 |
14 | 16 | with: |
15 | | - python-version: "3.8" |
| 17 | + python-version: "3.10" |
16 | 18 | - name: Checkout |
17 | | - uses: actions/checkout@v2 |
18 | | - - name: Set up QEMU |
19 | | - uses: docker/setup-qemu-action@v1 |
20 | | - - name: Set up Docker Buildx |
21 | | - uses: docker/setup-buildx-action@v1 |
22 | | - - name: Install dependencies |
23 | | - run: | |
24 | | - pip install --upgrade pip |
25 | | - pip install awscli |
26 | | - - uses: huggingface/tailscale-action@v1 |
| 19 | + uses: actions/checkout@v4 |
| 20 | + - name: Initialize Docker Buildx |
| 21 | + uses: docker/setup-buildx-action@v3 |
27 | 22 | with: |
28 | | - authkey: ${{ secrets.TAILSCALE_AUTHKEY }} |
29 | | - - name: Update upstream |
30 | | - env: |
31 | | - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
32 | | - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
33 | | - AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} |
34 | | - DEFAULT_HOSTNAME: ${{ secrets.DEFAULT_HOSTNAME }} |
35 | | - REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} |
36 | | - REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} |
37 | | - run: | |
38 | | - python build_docker.py latent-to-image --out out.txt |
| 23 | + install: true |
| 24 | + buildkitd-config: /tmp/buildkitd.toml |
| 25 | + - name: Inject slug/short variables |
| 26 | + uses: rlespinasse/[email protected] |
| 27 | + - name: Login to internal Container Registry |
| 28 | + uses: docker/login-action@v3 |
| 29 | + with: |
| 30 | + username: ${{ secrets.REGISTRY_USERNAME }} |
| 31 | + password: ${{ secrets.REGISTRY_PASSWORD }} |
| 32 | + registry: registry.internal.huggingface.tech |
| 33 | + - name: Extract metadata (tags, labels) for Docker |
| 34 | + id: meta-pr |
| 35 | + uses: docker/metadata-action@v5 |
| 36 | + with: |
| 37 | + images: | |
| 38 | + registry.internal.huggingface.tech/api-inference/community |
| 39 | + tags: | |
| 40 | + type=raw,value=latent-to-image-sha-${{ env.GITHUB_SHA_SHORT }} |
| 41 | + - name: Build and push Docker image |
| 42 | + id: build-and-push |
| 43 | + uses: docker/build-push-action@v4 |
| 44 | + with: |
| 45 | + context: docker_images/latent-to-image |
| 46 | + dockerfile: docker_images/latent-to-image/Dockerfile |
| 47 | + push: true |
| 48 | + platforms: 'linux/amd64' |
| 49 | + build-args: | |
| 50 | + GIT_SHA=${{ env.GITHUB_SHA }} |
| 51 | + DOCKER_LABEL=latent-to-image-sha-${{ env.GITHUB_SHA_SHORT }} |
| 52 | + PLATFORM=${{ env.PLATFORM }} |
| 53 | + tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }} |
| 54 | + labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} |
| 55 | + cache-from: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=latent-to-image-cache${{ env.LABEL }},mode=min,access_key_id=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_ACCESS_KEY_ID }},secret_access_key=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_SECRET_ACCESS_KEY }},mode=min |
| 56 | + cache-to: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=latent-to-image-cache${{ env.LABEL }},mode=min,access_key_id=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_ACCESS_KEY_ID }},secret_access_key=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_SECRET_ACCESS_KEY }},mode=min |
39 | 57 | - name: Deploy on API |
40 | 58 | run: | |
41 | 59 | # Load the tags into the env |
42 | | - cat out.txt >> $GITHUB_ENV |
43 | | - export $(xargs < out.txt) |
44 | | - echo ${LATENT_TO_IMAGE_CPU_TAG} |
| 60 | + echo sha-${{ env.GITHUB_SHA_SHORT }} |
45 | 61 | # Weird single quote escape mechanism because string interpolation does |
46 | 62 | # not work on single quote in bash |
47 | | - curl -H "Authorization: Bearer ${{ secrets.API_GITHUB_TOKEN }}" https://api.github.com/repos/huggingface/api-inference/actions/workflows/update_community.yaml/dispatches -d '{"ref":"main","inputs":{"framework":"LATENT_TO_IMAGE","tag": "'"${LATENT_TO_IMAGE_CPU_TAG}"'"}}' |
| 63 | + curl -H "Authorization: Bearer ${{ secrets.API_GITHUB_TOKEN }}" https://api.github.com/repos/huggingface-internal/api-inference/actions/workflows/update_community.yaml/dispatches -d '{"ref":"main","inputs":{"framework":"LATENT_TO_IMAGE","tag": "latent-to-image-sha-${{ env.GITHUB_SHA_SHORT }}"}}' |
| 64 | +
|
48 | 65 |
|
0 commit comments