Created
March 2, 2017 16:27
-
-
Save ericbmerritt/c1cc2aa29ac3f90a831ba8fffc77a52c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, symlinkJoin, dockerTools, coreutils, writeScript, glibcLocales, | |
metadrift }: | |
let | |
metadriftConfig = { | |
environment.systemPackages = [ metadrift ]; | |
}; | |
minimalDocker = | |
{ | |
imports = [ <nixpkgs/nixos/modules/profiles/minimal.nix> ]; | |
boot.isContainer = true; | |
environment.etc.machine-id.text = "00000000000000000000000000000000"; | |
}; | |
eval = | |
import <nixos/lib/eval-config.nix> { | |
modules = [ | |
minimalDocker | |
metadriftConfig | |
]; | |
}; | |
system = | |
eval.config.system; | |
rootDir = "/data"; | |
homeDir = "${rootDir}/var/lib/metadrift"; | |
logDir = "/data/log"; | |
port = 8743; | |
entrypoint = writeScript "entrypoint.sh" '' | |
#!${stdenv.shell} | |
set -e | |
exec ${metadrift}/bin/metadrift-exe --port ${toString port} | |
''; | |
in | |
dockerTools.buildImage rec { | |
name = "metadrift"; | |
contents = symlinkJoin { | |
name = "${name}-contents"; | |
paths = [ | |
system.build.etc | |
system.path | |
]; | |
}; | |
config = { | |
Cmd = [ "${entrypoint}" ]; | |
Env = [ "PATH=${coreutils}/bin:$PATH" | |
''LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"'']; | |
ExposedPorts = { | |
"${toString port}/tcp" = {}; | |
}; | |
WorkingDir = "/data"; | |
Volumes = { | |
"/data" = {}; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment