Fix statix warnings #61
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: Docker Image CI | |
| on: | |
| push: | |
| branches: ["master"] | |
| pull_request: | |
| branches: ["master"] | |
| jobs: | |
| amd64: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build image | |
| run: | | |
| nix build .#docker | |
| docker load < result | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-image-amd64 | |
| path: result | |
| arm64: | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build image | |
| run: | | |
| nix build .#docker | |
| docker load < result | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-image-arm64 | |
| path: result | |
| push: | |
| needs: [amd64, arm64] | |
| runs-on: ubuntu-latest | |
| services: | |
| registry: | |
| image: registry:2 | |
| ports: | |
| - 5000:5000 | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push amd64 container | |
| run: | | |
| TAG_PREFIX=${GITHUB_REF#refs/*/}-${{ github.run_id }} | |
| ARCHS=(amd64 arm64) | |
| IMAGES=() | |
| for arch in "${ARCHS[@]}"; do | |
| CONTAINER_WITH_TAG=$(docker load < docker-image-$arch/result | rev | cut -d' ' -f1 | rev) | |
| CONTAINER=$(echo "$CONTAINER_WITH_TAG" | cut -d: -f1) | |
| echo "CONTAINER_WITH_TAG: $CONTAINER_WITH_TAG" | |
| echo "CONTAINER: $CONTAINER" | |
| IMAGE="localhost:5000/$CONTAINER:${TAG_PREFIX}-$arch" | |
| echo "IMAGE: $IMAGE" | |
| docker tag "$CONTAINER_WITH_TAG" "$IMAGE" | |
| docker push "$IMAGE" | |
| IMAGES+=("$IMAGE") | |
| done | |
| echo "${IMAGES[@]}" | |
| docker buildx imagetools create \ | |
| -t ghcr.io/nicolaschan/$CONTAINER:latest \ | |
| -t ghcr.io/nicolaschan/$CONTAINER:${TAG_PREFIX} \ | |
| "${IMAGES[@]}" |