.forgejo: added cd and publishing for containers
This commit is contained in:
parent
3fffaf3bab
commit
a0ba1c7d56
45
.forgejo/workflows/build_docker_images.yaml
Normal file
45
.forgejo/workflows/build_docker_images.yaml
Normal 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
|
50
flake.nix
50
flake.nix
|
@ -38,15 +38,23 @@
|
||||||
inherit src;
|
inherit src;
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = with pkgs; [
|
||||||
# Add additional build inputs here
|
openssl
|
||||||
|
pkg-config
|
||||||
|
libiconv
|
||||||
|
curl # for utoipa
|
||||||
] ++ lib.optionals pkgs.stdenv.isDarwin [
|
] ++ lib.optionals pkgs.stdenv.isDarwin [
|
||||||
# Additional darwin specific inputs can be set here
|
# Additional darwin specific inputs can be set here
|
||||||
pkgs.libiconv
|
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
|
craneLibLLvmTools = craneLib.overrideToolchain
|
||||||
|
@ -160,6 +168,40 @@
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
inherit consumer producer;
|
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) {
|
} // lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
|
||||||
producer-consumer-llvm-coverage = craneLibLLvmTools.cargoLlvmCov (commonArgs // {
|
producer-consumer-llvm-coverage = craneLibLLvmTools.cargoLlvmCov (commonArgs // {
|
||||||
inherit cargoArtifacts;
|
inherit cargoArtifacts;
|
||||||
|
|
Loading…
Reference in a new issue