This repository is created for this Medium post
- edit
mode.env
setNODE_ENV=production
for production use orNODE_ENV=dev
for development use - run
docker-compose up
- access your project on
http://localhost:80
in production use,http://localhost:8080
in 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=1
to 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
Dockerfile
is 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