This repository provides an out-of-the-box environment for a fully dockerized web application.
Docker
,docker-compose
container platform, orchestrationTypescript
code frontend, backendMongoDB
document databaseExpress
web serverAngularJS
frontend js/ts frameworkNode.js
backendPug
template engine, used for Angular component templates
With this established environment, I could not get Angular (4) running, so I use AngularJS for now. Any ideas would be appreciated - just create a PR.
zero downtime development with Docker, hot code reload, browser auto-refresh, debugging
Docker
and Docker Compose
are necessary.
First, install dependencies locally.
npm install
Now, we use docker-compose
for orchestration of the 3 docker containers used:
web
is the node.js web server (based on the slim mhart/alpine-node)mongo
is the mongoDB database (based on mongo)mongo-import
feeds the db inmongo
with some dummy data (see sub-directorymongo-import
, also based on mongo)
To separate development features from the actual application, three docker-compose configs are used.
-
base.yml
is the base config -
dev.yml
should only be used for development environment, since it mounts the project directory, starts file watchers, enables auto-restarts and exposes debugging ports -
prod.yml
production-safe config
docker-compose -f compose-base.yml -f compose-prod.yml up
docker-compose -f compose-base.yml -f compose-dev.yml up --build
-build
rebuilds the image if changes are detected
optional: -d
makes the container running in the background (use docker stop
to stop)
The repository contains a debug configuration which you can use with WebStorm
for example.
See more details about remote node.js debugging here