GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - docker-nginx-static/docker-nginx-static: Super Lightweight Nginx Image

BranchesTags
Open more actions menu

Latest commit

 

History

163 Commits
163 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
test
test
 
 
.renovaterc.json
.renovaterc.json
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
nginx.conf
nginx.conf
 
 
nginx.vh.default.conf
nginx.vh.default.conf
 
 

Repository files navigation

GitHub Docker Pulls GitHub stars

Super Lightweight Nginx Image

docker run -v /absolute/path/to/serve:/static -p 8080:80 flashspys/nginx-static

This command exposes an nginx server on port 8080 which serves the folder /absolute/path/to/serve from the host.

The image can only be used for static file serving but has with less than 4 MB roughly 1/10 the size of the official nginx image. The running container needs ~1 MB RAM.

Tags

tag example mutable
latest flashspys/nginx-static yes, every release
nginx version flashspys/nginx-static:1.31.3 yes, rebuilt on Alpine and config updates so you keep getting security fixes
commit sha flashspys/nginx-static:sha-<full commit sha> no, pin this if you need a fixed image

Images are published to both Docker Hub (flashspys/nginx-static) and GHCR (ghcr.io/docker-nginx-static/nginx-static).

The nginx and Alpine versions of an image are readable without running it:

docker inspect -f '{{.Config.Labels}}' flashspys/nginx-static

Releases

Every published image gets a GitHub release. To be notified of new images, use Watch → Custom → Releases on this repository.

nginx-static via HTTPS

To serve your static files over HTTPS you must use another reverse proxy. We recommend træfik as a lightweight reverse proxy with docker integration. Do not even try to get HTTPS working with this image only, as it does not contain the nginx ssl module.

nginx-static with docker-compose

This is an example entry for a docker-compose.yaml

version: '3'
services:
  example.org:
    image: flashspys/nginx-static
    container_name: example.org
    ports:
      - 8080:80
    volumes: 
      - /path/to/serve:/static

nginx-static with træfik 2.x

To use nginx-static with træfik 2.x add an entry to your services in a docker-compose.yaml. To set up traefik look at this simple example.

In the following example, replace everything contained in <angle brackets> and the domain with your values.

services:
  traefik:
    image: traefik:2.4 # check if there is a newer version
  # Your traefik config.
    ...
  example.org:
    image: flashspys/nginx-static
    container_name: example.org
    expose:
      - 80
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.<router>.rule=Host(`example.org`)"
      - "traefik.http.routers.<router>.entrypoints=<entrypoint>"
# If you want to enable SSL, uncomment the following line.
#      - "traefik.http.routers.<router>.tls.certresolver=<certresolver>"
    volumes: 
      - /host/path/to/serve:/static

If traefik and the nginx-static are in distinct docker-compose.yml files, please make sure that they are in the same network.

For a traefik 1.7 example look at an old version of the readme

nginx-static for multi-stage builds

nginx-static is also suitable for multi-stage builds. This is an example Dockerfile for a static node.js application:

FROM node:alpine
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install && npm run build

FROM flashspys/nginx-static
RUN apk update && apk upgrade
COPY --from=0 /usr/src/app/dist /static

Custom nginx config

In the case you already have your own Dockerfile you can easily adjust the nginx config by adding the following command in your Dockerfile. In case you don't want to create an own Dockerfile you can also add the configuration via volumes, e.g. appending -v /absolute/path/to/custom.conf:/etc/nginx/conf.d/default.conf in the command line or adding the volume in the docker-compose.yaml respectively. This can be used for advanced rewriting rules or adding specific headers and handlers. See the default config here.

…
FROM flashspys/nginx-static
RUN rm -rf /etc/nginx/conf.d/default.conf
COPY your-custom-nginx.conf /etc/nginx/conf.d/default.conf

About

Super Lightweight Nginx Image

hub.docker.com/r/flashspys/nginx-static/

Topics

dockernginxstatic-server

Resources

Readme
Activity
Custom properties

Stars

142 stars

Watchers

5 watching

Forks

39 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.