javifmz / webapp-dnc

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:MIT License


Languages

Language:Shell 57.0%Language:Dockerfile 43.0%