Skip to content

Commit

Permalink
update docker github workflow to use nix
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaykarle committed Oct 17, 2024
1 parent dfcab61 commit c2e1816
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
51 changes: 34 additions & 17 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,32 @@ jobs:
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Remove software and languages
# copied from: https://github.com/actions/runner-images/issues/2840#issuecomment-2327466240
shell: bash
run: |
df -h /
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
df -h /
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main
- name: Build image
run: nix build .#dockerImage
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
Expand All @@ -31,21 +55,14 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
- name: Load and push image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

run: |
docker load --input result
docker tag pii:latest
docker push ${{ format('{0}/{1}:latest', env.REGISTRY, env.IMAGE_NAME) }}
docker tag pii:${{ steps.meta.outputs.tags }}
docker push ${{ format('{0}/{1}:{2}', env.REGISTRY, env.IMAGE_NAME, steps.meta.outputs.tags) }}
13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

0 comments on commit c2e1816

Please sign in to comment.