feat: build the container image with nix

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
Harald Hoyer 2024-02-13 13:00:57 +01:00
parent b0653b4246
commit 4fabbf8f3f
Signed by: harald
GPG key ID: F519A1143B3FBE32
7 changed files with 117 additions and 185 deletions

63
.github/workflows/nix.yml vendored Normal file
View file

@ -0,0 +1,63 @@
name: nix
on:
pull_request:
branches: [ "main" ]
push:
branches: [ "main" ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: cachix/install-nix-action@6004951b182f8860210c8d6f0d808ec5b1a33d28 # v25
with:
extra_nix_config: |
access-tokens = github.com=${{ github.token }}
- run: nix flake check -L --show-trace --keep-going
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: cachix/install-nix-action@6004951b182f8860210c8d6f0d808ec5b1a33d28 # v25
with:
extra_nix_config: |
access-tokens = github.com=${{ github.token }}
- run: nix fmt
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: cachix/install-nix-action@6004951b182f8860210c8d6f0d808ec5b1a33d28 # v25
with:
extra_nix_config: |
access-tokens = github.com=${{ github.token }}
- uses: cachix/cachix-action@v14
continue-on-error: true
with:
name: vault-auth-tee
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: nixsgx
- name: nix build
run: nix run nixpkgs#nixci
- name: nix docker image
run: |
nix build .#dockerImage
docker load -i result
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Container
uses: docker/build-push-action@v5
with:
tags: matterlabsrobot/vault-auth-tee:latest
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}