Skip to content

A minimal Docker image to develop web apps with Node.js for the front-end and Composer for the back-end

License

Notifications You must be signed in to change notification settings

javifmz/webapp-dnc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DNC Webapp

📖 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).

Configuring the webapp

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.

Accesing the webapp

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 the API_PATH environment variable to rest without slashes (API_PATH=rest).

The exposed port is 80.

Example of usage with docker-compose

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

Usage without docker-compse

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

Image at Docker Hub

This image is available at Docker Hub as javifmz/webapp-dnc.

About

A minimal Docker image to develop web apps with Node.js for the front-end and Composer for the back-end

Topics

Resources

License

Stars

Watchers

Forks