cd: flake.nix added container packages
Some checks failed
CD / docker (push) Failing after 40s

.forgejo: added cd and publishing for containers
This commit is contained in:
2005 2024-08-25 03:48:11 +02:00
parent 3fffaf3bab
commit a0ba1c7d56
2 changed files with 91 additions and 4 deletions

View file

@ -0,0 +1,45 @@
name: CD
on:
push:
branches: ["master"]
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU for docker
uses: https://github.com/docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
-
name: Set up nix cachix
uses: https://github.com/DeterminateSystems/magic-nix-cache-action@main
-
name: Login to git.4o1x5.dev container registry
uses: docker/login-action@v3
with:
registry: git.4o1x5.dev
username: ${{ secrets.GIT_USERNAME }}
password: ${{ secrets.GIT_TOKEN }}
-
name: Setup nix for building
uses: https://github.com/cachix/install-nix-action@v27
with:
# add kvm support
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
-
name: Build, import, tag and push producer container
run: nix build .#producer-container && docker image load --input result && docker image tag producer:latest git.4o1x5.dev/4o1x5/producer:latest && docker image push git.4o1x5.dev/4o1x5/producer:latest
-
name: Build, import, tag and push consumer container
run: nix build .#consumer-container && docker image load --input result && docker image tag consumer:latest git.4o1x5.dev/4o1x5/consumer:latest && docker image push git.4o1x5.dev/4o1x5/consumer:latest

View file

@ -38,15 +38,23 @@
inherit src;
strictDeps = true;
buildInputs = [
# Add additional build inputs here
buildInputs = with pkgs; [
openssl
pkg-config
libiconv
curl # for utoipa
] ++ lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.libiconv
];
nativeBuildInputs = with pkgs;[
openssl
pkg-config
libiconv
curl # for utoipa
makeWrapper
];
# Additional environment variables can be set directly
# MY_CUSTOM_VAR = "some value";
};
craneLibLLvmTools = craneLib.overrideToolchain
@ -160,6 +168,40 @@
packages = {
inherit consumer producer;
producer-container = pkgs.dockerTools.buildLayeredImage {
name = "producer";
tag = "latest";
contents = with pkgs; [
cacert
openssl
pkg-config
libiconv
];
config = {
WorkingDir = "/app";
Volumes = { "/app" = { }; };
Entrypoint = [ "${producer}/bin/producer" ];
};
};
consumer-container = pkgs.dockerTools.buildLayeredImage {
name = "consumer";
tag = "latest";
contents = with pkgs; [
cacert
openssl
pkg-config
libiconv
];
config = {
WorkingDir = "/app";
Volumes = { "/app" = { }; };
Entrypoint = [ "${consumer}/bin/consumer" ];
};
};
} // lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
producer-consumer-llvm-coverage = craneLibLLvmTools.cargoLlvmCov (commonArgs // {
inherit cargoArtifacts;