Skip to content

Provides a server (via Express.js) to expose static files from the Docker host via HTTP

License

Notifications You must be signed in to change notification settings

nicolasacchi/docker-node-webserver

 
 

Repository files navigation

node-webserver

Provides a minimal webserver (via Express.js) to expose static files from the Docker host via HTTP. This image is build on Alpine Linux (base image alpine:node) and aims for a minimal size.

Usage

You can expose a local directory which you want to have served via the mini-webserver by starting it with

docker run --name node-web -p 8080:8080 -v $PWD/test:/app/public:ro -d netresearch/node-webserver

In this example, the port on the docker host where the node-webserver is reachable is 8080.

docker-compose.yml example

version: '3.5'
services:
  app:
    image: netresearch/node-webserver
    environment:
      - VIRTUAL_HOST=my.example.com
      - VIRTUAL_NETWORK=webproxy
      - VIRTUAL_PORT=8080
    volumes:
      - ./app:/app/public:ro
    restart: always

networks:
  default:
    external:
      name: webproxy

Customization

You can override customize.js in order to customize the express application

Logging

The Express.js app uses morgan to pipe the web logs to the STDOUT. This means that the logs are visible via docker logs node-web (if the container name is node-web).

About

Provides a server (via Express.js) to expose static files from the Docker host via HTTP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 65.6%
  • HTML 22.6%
  • Dockerfile 11.8%