depot/docker-images.nix

36 lines
1.4 KiB
Nix
Raw Normal View History

2020-10-04 01:34:09 +00:00
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
let
depot = (import ./default.nix {});
pkgs = depot.third_party.nixpkgs;
lib = pkgs.lib;
images = {
"registry.apps.k8s.lukegb.tech/twitterchiver/archiver:latest" = depot.go.twitterchiver.archiver.dockerImage;
"registry.apps.k8s.lukegb.tech/twitterchiver/viewer:latest" = depot.go.twitterchiver.viewer.dockerImage;
"registry.apps.k8s.lukegb.tech/twitterchiver/relatedfetcher:latest" = depot.go.twitterchiver.relatedfetcher.dockerImage;
"registry.apps.k8s.lukegb.tech/lukegb-openshiftauth-test/example:latest" = depot.go.openshiftauth.example.dockerImage;
2020-10-10 17:10:33 +00:00
"registry.apps.k8s.lukegb.tech/depotcron/update_nixpkgs:latest" = depot.ops.maint.update_nixpkgs;
2020-10-04 01:34:09 +00:00
};
baseName = p: builtins.elemAt (builtins.match "^[a-z0-9]+-([^.]+).*$" (baseNameOf p)) 0;
2020-10-04 01:34:09 +00:00
crane = "${depot.nix.pkgs.crane}/bin/crane";
pushCommands = lib.mapAttrsToList (name: value: ''
${pkgs.gzip}/bin/gunzip -c ${value} > /tmp/push.tar
${crane} push /tmp/push.tar ${name}
2020-10-04 01:34:09 +00:00
'') images;
authCommands = lib.mapAttrsToList (name: value: ''
${crane} auth login ${name} -u "${value.user}" -p "${value.password}"
'') depot.ops.secrets.deployer.dockerRegistryAuth;
in
2020-10-10 21:02:23 +00:00
((pkgs.writeShellScript "push-images" ''
2020-10-04 01:34:09 +00:00
${lib.concatStringsSep "\n" authCommands}
${lib.concatStringsSep "\n" pushCommands}
2020-10-10 21:02:23 +00:00
'') // {
images = images;
})