Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save wanyutang/11e134355d84c8109663a449003a7713 to your computer and use it in GitHub Desktop.

Select an option

Save wanyutang/11e134355d84c8109663a449003a7713 to your computer and use it in GitHub Desktop.
# To learn more about how to use Nix to configure your environment
# see: https://developers.google.com/idx/guides/customize-idx-env
{ pkgs, ... }: {
# Which nixpkgs channel to use.
channel = "stable-23.11"; # or "unstable"
# Use https://search.nixos.org/packages to find packages
packages = [
# pkgs.go
# pkgs.python311
# pkgs.python311Packages.pip
# pkgs.nodejs_20
# pkgs.nodePackages.nodemon
# pkgs.nodenv
# pkgs.nodejs
pkgs.docker
];
# Sets environment variables in the workspace
env = {};
services.docker.enable = true;
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
# "vscodevim.vim"
];
# Enable previews
previews = {
enable = true;
previews = {
# web = {
# # Example: run "npm run dev" with PORT set to IDX's defined port for previews,
# # and show it in IDX's web preview panel
# command = ["npm" "run" "dev"];
# manager = "web";
# env = {
# # Environment variables to set for your server
# PORT = "$PORT";
# };
# };
};
};
# Workspace lifecycle hooks
workspace = {
# Runs when a workspace is first created
onCreate = {
# Example: install JS dependencies from NPM
# npm-install = "npm install";
};
# Runs when the workspace is (re)started
onStart = {
# Example: start a background task to watch and re-build backend code
# watch-backend = "npm run watch-backend";
# runCommands = [
# "git clone https://github.com/nodenv/node-build.git ~/.nodenv/plugins/node-build"
# "nodenv rehash"
# "nodenv install 14.17.6"
# "nodenv global 14.17.6"
# ];
};
};
};
}
version: '3'
services:
app:
image: node:14
container_name: node-app
working_dir: /usr/src/app
volumes:
- .:/usr/src/app
ports:
- "8080:8080"
- "8081:8081"
command: sh -c "npm install && npm run start"
restart: unless-stopped
environment:
- NODE_ENV=development
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment