This repository is created for this Medium post
- edit
mode.envsetNODE_ENV=productionfor production use orNODE_ENV=devfor development use - run
docker-compose up - access your project on
http://localhost:80in production use,http://localhost:8080in development use
# For development
$ node index.js
# For production
$ webpack
$ NODE_ENV=production node index.js- get inside running container use
$docker exec -it <container_name> /bin/bash - delete all inactive containers use
docker container rm `docker ps -aq -f status=exited` - on windows there can be problem with file path, especially with :, set this enviroment variable
COMPOSE_CONVERT_WINDOWS_PATHS=1to fix the problem - list all images
docker images -a - list all containers
docker ps -a - list all volumes
docker volume list
This runs application in production mode, which can be accesses on http://localhost:80
- navigate to app directory (where
Dockerfileis located) - build image
docker build -t drft/generic-webpack-docker . - running container
docker run -d -v `pwd`:/usr/src/app/ -p 80:4000 drft/generic-webpack-docker