initial setup
Some checks failed
Create OCI image(s) / Build and push images (push) Failing after 1s

This commit is contained in:
Chris Kruining 2025-09-08 09:20:53 +02:00
parent a462c7d90f
commit 69bab20f53
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
2 changed files with 75 additions and 0 deletions

View file

@ -0,0 +1,47 @@
name: Create OCI image(s)
on:
workflow_dispatch:
push:
branches:
- main
env:
registry: git.amarth.cloud
owner: amarth
image: default
tag: latest
jobs:
build:
name: Build and push images
runs-on: default
steps:
- name: Checkout
run: |
git clone ${{ forge.server_url }}/${{ forge.repository }}.git .
- name: Prepare podman
run: |
# configure container policy to accept insecure registry
nix-env -iA nixpkgs.podman nixpkgs.kvmtool
# configure container policy to accept insecure registry
mkdir -p ~/.config/containers
echo '{ "default": [ {"type":"insecureAcceptAnything"} ] }' > ~/.config/containers/policy.json
- name: Log into registry
run: |
podman login --username "${{ forge.actor }}" --password "${{ forge.token }}" ${{ env.registry }}
- name: Create image
run: |
nix-build src/default.nix
podman load < result
- name: Push image
run: >-
podman push
--creds="${{ forge.actor }}:${{ forge.token }}"
localhost/default:latest
${{ env.registry }}/${{ env.owner }}/${{ env.image }}:${{ env.tag }}

28
src/default.nix Normal file
View file

@ -0,0 +1,28 @@
{
pkgs ? import <nixpkgs> {},
pkgs_linux ? import <nixpkgs> { system = "x86_64-linux"; },
}:
with pkgs;
dockerTools.buildImage {
name = "default";
tag = "latest";
copyToRoot = buildEnv {
name = "image-root";
pathsToLink = [ "/bin" ];
paths = with pkgs_linux; [
coreutils
u-root-cmds
bash
nix
nodejs
podman
];
};
config = {
User = "runner";
Cmd = [ "${lib.getExe bashInteractive}" ];
};
}