📖 DNC = Docker-Node-Composer
A minimal Docker image to run or develop web apps with Node.js for the front-end (web) and Composer for the back-end (api).
To work with this image, put your web files in the /webapp/web
directory and your api files in the /webapp/api
directory.
If the web and api ports of your webapp are different from the default ones (8080
for web and 8081
for api), they can be overriden using the WEB_PORT
and API_PORT
environment variables respectively.
The web is accesible at the root path (localhost
), and the api at the /api
path (localhost/api
). This path can also be overriden using the API_PATH
enviroment variable.
If the desired path for the api is
/rest
, set theAPI_PATH
environment variable torest
without slashes (API_PATH=rest
).
The exposed port is 80
.
services:
webapp:
image: javifmz/webapp-dnc
volumes:
- ./api:/webapp/api
- ./web:/webapp/web
- /webapp/vendor
- /webapp/node_modules
ports:
- 8080:80
environment:
- API_PATH=api
- API_PORT=8081
- WEB_PORT=8080
docker-compose up -d
docker-compose down
docker run --rm -it \
-v "$PWD/web:/webapp/web" \
-v "$PWD/api:/webapp/api" \
-v "/webapp/web/node_modules" \
-v "/webapp/api/vendor" \
-e "API_PATH=api" \
-e "API_PORT=8081" \
-e "WEB_PORT=8080" \
-p "8080:80"
javifmz/webapp-dnc
This image is available at Docker Hub as javifmz/webapp-dnc.