Skip to content

Commit

Permalink
feat: build container via nix in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
uulm-janbaudisch committed May 4, 2024
1 parent 3e12289 commit 65f0b7e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/Container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Container

on:
- push

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
TAG: ${{ github.ref_name }}

jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
- name: Build
run: nix build -L .#container
- name: Login
run: nix run nixpkgs#skopeo -- login $REGISTRY --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
- name: Push
run: nix run nixpkgs#skopeo -- copy docker-archive:result docker://$REGISTRY/$IMAGE_NAME:$TAG
- name: Push latest tag
if: ${{ github.ref_type == 'tag' }}
run: nix run nixpkgs#skopeo -- copy docker://$REGISTRY/$IMAGE_NAME:$TAG docker://$REGISTRY/$IMAGE_NAME:latest
9 changes: 8 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@
container = pkgs.dockerTools.buildLayeredImage {
name = "d4v2";
contents = [ self.packages.${system}.d4 ];
config.Entrypoint = [ "/bin/d4" ];
config = {
Entrypoint = [ "/bin/d4" ];
Labels = {
"org.opencontainers.image.source" = "https://github.com/SoftVarE-Group/d4v2";
"org.opencontainers.image.description" = "A CNF to d-DNNF compiler";
"org.opencontainers.image.licenses" = "LGPL-2.1-or-later";
};
};
};

mt-kahypar = pkgs.stdenv.mkDerivation {
Expand Down

0 comments on commit 65f0b7e

Please sign in to comment.