add a woodpecker pipeline for publishing docker images

This commit is contained in:
Armaël Guéneau 2025-02-20 14:54:04 +01:00
parent 1cccf3bff9
commit 7546cee54c
2 changed files with 20 additions and 2 deletions

View file

@ -17,9 +17,9 @@ steps:
- name: build
image: nixpkgs/nix:nixos-22.05
commands:
- nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.debug
- nix build -j4 --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.debug
- name: test
image: nixpkgs/nix:nixos-22.05
commands:
- nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.test
- nix build -j4 --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.test

18
.woodpecker/publish.yaml Normal file
View file

@ -0,0 +1,18 @@
when:
event:
- deployment
- cron
steps:
- name: docker build and publish
image: nixpkgs/nix:nixos-22.05
environment:
DOCKER_AUTH:
from_secret: docker_auth
commands:
- mkdir -p /root/.docker
- echo $DOCKER_AUTH > /root/.docker/config.json
- export CONTAINER_TAG=${CI_COMMIT_TAG:-$CI_COMMIT_SHA}
- nix-build -j4 --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.docker
- nix-shell -p gzip --run "gunzip -c ./result > image.tar"
- nix-shell -p crane --run "crane push ./image.tar dxflrs/tricot:$CONTAINER_TAG"