๐Ÿ“ฆ derek-adair / docker-node-sandbox

A contrived development environment using node.

โ˜… 0 stars โ‘‚ 0 forks ๐Ÿ‘ 0 watching
๐Ÿ“ฅ Clone https://github.com/derek-adair/docker-node-sandbox.git
HTTPS git clone https://github.com/derek-adair/docker-node-sandbox.git
SSH git clone git@github.com:derek-adair/docker-node-sandbox.git
CLI gh repo clone derek-adair/docker-node-sandbox
Derek Derek Npm usage formatting f53b180 6 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ sandbox
๐Ÿ“„ .dockerignore
๐Ÿ“„ .env-ui
๐Ÿ“„ .env-ui.example
๐Ÿ“„ docker-compose.yml
๐Ÿ“„ Dockerfile
๐Ÿ“„ README.md
๐Ÿ“„ README.md

Node Sandbox

This docker image builds and runs a node app that is compatible with yarn. I use it to easily clone and host javascript projects on my remote development environment. I use it along side with nginx/letsencrypt proxy to easily develop on this code in a cloud-based IDE.

Run it

  • (optional) replace node source code in /sandbox (comes with the create-react-app stock app)
  • $docker-node-sandbox> cp .env-ui.example .env-ui
  • docker-compose up
Your app is now running on :80 of your docker host.

Customize

This setup is very barebones and lends itself to customization.

Change Port

Two things need to be edited in order to modify the port:

  • change expose:80 to expose:{your_port} in docker-compose.yml
  • change PORT=80 to PORT={your_port} in .env-ui

Adding/Removing Packages

  • Make sure you have yarn installed
  • yarn add {package_name} 2. docker-compose up --build --force-recreate *--build and --force-recreate ensure's you get a fresh container and build, I am looking for a better way to handle caching of node_modules, which will make adding/removing/upgrading deps more automatic* ### Using npm instead of yarn **Spin up node-app container with bash instead of yarn start** 1. docker-compose run node-app bash -il **In the container install and run the app** 2. npm install && npm start`