this was an attempt to utilize docker compose profiles for f.e. dev/prod setup but it didn't prove as usefull as simply using overrides or separate dev/prod file
NodeJS LTS with Docker for Development Template comes with
- a docker-compose configuration to mount the project path under
/appinside a container for serving/building/modifications - a simply command to start up a bash inside a nodejs container usefull for running
npmcommands, tests and so on - a simple server command which is usally enough to startup a http-server for development
- an npm cache config which puts the cache in
.npm-cachesuch that you won't loose the cache evertime the container is rebuild
- check
.gitignore - check
.docker/dev-toolbox/Dockerfilehas all the tools you need - check
.docker/dev-server/Dockerfilehas the correct starting command
Start a new bash inside a container with:
docker compose run --rm toolboxBe aware that this can be run multiple times and it is always a new container created (and with --rm flag also deleted) so modifications like installing other stuff outside of the mounted path won't be saved.
Start a new server inside a container with:
docker compose up serverand stop it from another shell with
docker compose down serverThe default setup is configured to map container port 3000 to 127.0.0.1:8080.
Sometimes it is usefull to run:
docker compose down --remove-orphansto cleanup created containers which were not deleted for whatever reason.