Add version file for crane push

This commit is contained in:
Paul Brinkmeier 2025-04-23 13:27:11 +02:00
parent 831d3765ef
commit c98044dbbc
2 changed files with 22 additions and 8 deletions

View File

@ -1,23 +1,34 @@
name: Build container name: Build image
on: [push] on: [push]
jobs: jobs:
build-container: build-image:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
- run: ls -l - run: ls -l
- run: apt update && apt install sudo - run: apt-get update && apt-get install -y sudo
- name: Install Nix - name: Install Nix
uses: cachix/install-nix-action@v31 uses: cachix/install-nix-action@v31
with: with:
enable_kvm: false enable_kvm: false
- name: Build container - name: Build image
run: nix build .#docker run: nix build .#image -o image.tar.gz
- name: Get image name
run: nix build .#image-name -o image-name
- run: ls -l - run: ls -l
- run: ls -l $(readlink -f result) - run: ls -l $(readlink -f image.tar.gz)
- name: Install crane - name: Install crane
run: | run: |
curl -sL "https://github.com/google/go-containerregistry/releases/download/v0.20.3/go-containerregistry_Linux_x86_64.tar.gz" > go-containerregistry.tar.gz curl -sL "https://github.com/google/go-containerregistry/releases/download/v0.20.3/go-containerregistry_Linux_x86_64.tar.gz" > go-containerregistry.tar.gz
tar -zxvf go-containerregistry.tar.gz -C /usr/local/bin/ crane tar -zxvf go-containerregistry.tar.gz -C /usr/local/bin/ crane
- run: crane push result
- run: echo $(cat image-name)
- run: tar tvf image.tar.gz
- run: echo $(readlink -f image.tar.gz)
- uses: actions/upload-artifact@v3
with:
name: tarball
path: image.tar.gz
- run: crane push $(readlink -f image.tar.gz) $(cat image-name)

View File

@ -39,7 +39,10 @@
}; };
packages.${system} = { packages.${system} = {
default = vrnp-static; default = vrnp-static;
docker = pkgs.dockerTools.buildImage { image-name = pkgs.runCommand "vrnp-version" {} ''
echo -n git.pbrinkmeier.de/paul/vrnp:${vrnp-static.version} > $out
'';
image = pkgs.dockerTools.buildImage {
name = "git.pbrinkmeier.de/paul/vrnp"; name = "git.pbrinkmeier.de/paul/vrnp";
tag = vrnp-static.version; tag = vrnp-static.version;
copyToRoot = pkgs.buildEnv { copyToRoot = pkgs.buildEnv {