Skip to content

Instantly share code, notes, and snippets.

@lucabrunox
Last active April 15, 2016 08:35
Show Gist options
  • Save lucabrunox/4d2dabc1fe6342b621af108eb5f26905 to your computer and use it in GitHub Desktop.
Save lucabrunox/4d2dabc1fe6342b621af108eb5f26905 to your computer and use it in GitHub Desktop.
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
redis = pkgs.redis.overrideDerivation (attrs: rec {
name = "redis-2.8.23";
src = fetchurl {
url = "http://download.redis.io/releases/${name}.tar.gz";
sha256 = "1kjsx79jhhssh5k9v17s9mifaclkl6mfsrsv0cvi583qyiw9gizk";
};
});
in
dockerTools.buildImage {
name = "redis";
tag = "2.8.23";
runAsRoot = ''
#!${stdenv.shell}
${dockerTools.shadowSetup}
groupadd -r redis
useradd -r -g redis -d /data -M redis
mkdir /data
chown redis:redis /data
'';
config = {
Cmd = [ "${goPackages.gosu.bin}/bin/gosu" "redis" "${redis}/bin/redis-server" ];
ExposedPorts = {
"6379/tcp" = {};
};
WorkingDir = "/data";
Volumes = {
"/data" = {};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment