Skip to content
This repository was archived by the owner on Mar 30, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
let
tools = import ./tools-overlay.nix;
contrail = import ./contrail-overlay.nix;
pkgs = import nixpkgs { overlays = [ tools contrail ]; };
dockerImages = pkgs.callPackages ./pkgs/docker-images/default.nix { };

in import nixpkgs { overlays = [ tools contrail ]; }
in pkgs // { inherit dockerImages; }
50 changes: 50 additions & 0 deletions pkgs/docker-images/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ pkgs, runCommand, dockerTools, contrail50 }:

let
tungstenApi = dockerTools.pullImage {
imageName = "docker.io/opencontrailnightly/contrail-controller-config-api";
imageDigest = "sha256:7ebb285df2fdd512f6b885b772e6b2383ad1f23488d6a767f8bb21e55239fe62";
finalImageTag = "latest";
sha256 = "1qpw5vdvga3qd66rzdfsdw3wc51jf7hd9k16l41yphqrwc2ng75h";
};

tungstenSchema = dockerTools.pullImage {
imageName = "docker.io/opencontrailnightly/contrail-controller-config-schema";
imageDigest = "sha256:b6bc624a05de7d554df37096431f1ea0ea2086368e9f96fbdf1868f5eeb53a16";
finalImageTag = "latest";
sha256 = "06kz45wfgnyzi717dv79im263pl5pwpxklangqd3a6hzh4xd7g8p";
};

# This is because symlinked directory in the parent image are not
# supported by nixpkgs.dockerTools.buildImage:/
# See https://github.com/NixOS/nixpkgs/issues/57073
toUsrBin = drv: runCommand "${drv.name}-to-usr-bin" {} ''
mkdir -p $out/usr/bin/
for i in $(ls ${drv}/bin/); do
ln -s ${drv}/bin/$i $out/usr/bin/$i
done
'';

in {
contrailApi = dockerTools.buildImage {
name = "contrail-api";
tag = "r5.0";
fromImage = tungstenApi;
contents = toUsrBin contrail50.apiServer;
config = {
Entrypoint = [ "/entrypoint.sh" ];
};
};
contrailSchema = dockerTools.buildImage {
name = "contrail-schema";
tag = "r5.0";
fromImage = tungstenSchema;
contents = toUsrBin contrail50.schemaTransformer;
config = {
Entrypoint = [ "/entrypoint.sh" ];
};
};

# TODO: Add all other images. Since binaries already exist, it's a
# trivial task.
}