Attempt to fix CI errors #408
This file contains hidden or 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: "Nix Build Docker image" | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*' | |
concurrency: | |
group: nix-image-${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build_nix_image: | |
runs-on: | |
group: aws-highmemory-32-plus-priv | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v14 | |
with: | |
name: huggingface | |
# If you chose signing key for write access | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
env: | |
USER: github_runner | |
- name: Build | |
run: nix build .#dockerImage | |
- name: Initialize Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
buildkitd-config: /tmp/buildkitd.toml | |
- name: Inject slug/short variables | |
uses: rlespinasse/[email protected] | |
- name: Login to internal Container Registry | |
# if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
registry: registry.internal.huggingface.tech | |
- name: Push to docker | |
run: | | |
if [ "${{ github.event_name }}" = "pull_request" ]; then | |
export TAG=nix-sha-${{ env.GITHUB_SHA_SHORT }} | |
else | |
export TAG=${{ github.ref_name }}-nix | |
fi | |
export IMAGE=registry.internal.huggingface.tech/api-inference/community/text-generation-inference:$TAG | |
nix-shell -p skopeo --command "skopeo --insecure-policy copy docker-archive:$(readlink -f ./result) docker://$IMAGE --dest-compress-format zstd" |