shrub/nix/ops/image/default.nix
Brendan Hay 4813d9829b
build: simplify image build interface
This removes the baked in codedump inspection and wrapper scripts
in favour of downstream tooling overriding this as necessary by
using FROM <image> in their respective dockerfile.
2019-10-22 10:18:37 +08:00

50 lines
765 B
Nix

{ pkgs, urbit, pill }:
let
entrypoint = pkgs.writeScript "entrypoint.sh" ''
#!${pkgs.stdenv.shell}
set -euo pipefail
${urbit.meta.exe} "$@"
'';
in
pkgs.dockerTools.buildImage {
name = urbit.meta.name;
runAsRoot = ''
#!${pkgs.stdenv.shell}
set -euo pipefail
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH
${pkgs.dockerTools.shadowSetup}
mkdir -p /bin /share /data /tmp
${pkgs.coreutils}/bin/ln -sf ${pill} /share/urbit.pill
${pkgs.coreutils}/bin/ln -sf ${entrypoint} /bin/urbit
'';
config = {
Entrypoint = [ "urbit" ];
WorkingDir = "/data";
Env = [ "PATH=/bin" ];
Volumes = {
"/data" = {};
};
ExposedPorts = {
"80/tcp" = {};
"443/tcp" = {};
};
};
}