-
Notifications
You must be signed in to change notification settings - Fork 22
/
release.nix
25 lines (21 loc) · 928 Bytes
/
release.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ nixpkgs ? import <nixpkgs> {}
}:
let
package = import ./default.nix {
inherit nixpkgs;
};
image = package.image {};
imagePlus = package.image { additionalContents = with nixpkgs; [ bash coreutils google-cloud-sdk ]; };
# script to push images to registry
# depends on runtime vars DOCKERHUB_USERNAME, DOCKERHUB_PASSWORD, and DOCKERHUB_IMAGE
pushImagesScript = nixpkgs.writeScript "push-images" ''
#!${nixpkgs.stdenv.shell} -e
${nixpkgs.skopeo}/bin/skopeo --insecure-policy copy --dest-creds $DOCKERHUB_USERNAME:$DOCKERHUB_PASSWORD docker-archive:${image} docker://$DOCKERHUB_IMAGE
${nixpkgs.skopeo}/bin/skopeo --insecure-policy copy --dest-creds $DOCKERHUB_USERNAME:$DOCKERHUB_PASSWORD docker-archive:${imagePlus} docker://$DOCKERHUB_IMAGE:plus
'';
in with package; {
inherit bins image imagePlus pushImagesScript;
touch = bins // {
inherit image imagePlus pushImagesScript;
};
}