Skip to content

Instantly share code, notes, and snippets.

@portothree
Created December 27, 2021 12:23
Show Gist options
  • Select an option

  • Save portothree/57c90827077be6fe20f6decb190ad1c5 to your computer and use it in GitHub Desktop.

Select an option

Save portothree/57c90827077be6fe20f6decb190ad1c5 to your computer and use it in GitHub Desktop.
MongoDB and NodeJS arion-compose.nix file
{ pkgs, ... }: {
config.services = {
mongodb = {
service = {
image = "mongo:latest";
container_name = "pgil-mongodb";
ports = [ "27030:27017" ];
volumes = [ "${toString ./.}/tmp/mongodb-data:/data/db" ];
stop_signal = "SIGINT";
};
};
api = {
image = {
command = [
"${pkgs.writeScript "entrypoint" ''
#!${pkgs.bash}/bin/bash
${pkgs.nodejs-14_x}/bin/node code/bin/www
''}"
];
};
service = {
build = { context = "."; };
container_name = "pgil-api";
ports = [ "30003:3000" ];
volumes = [ "${toString ./.}:/code" ];
environment = {
NODE_ENV = "test";
MONGO_URI = "mongodb://localhost:27030/cmlQart";
};
stop_signal = "SIGINT";
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment