{"id":13580711,"url":"https://github.com/docker-nginx-static/docker-nginx-static","last_synced_at":"2025-04-06T02:32:34.640Z","repository":{"id":35981956,"uuid":"138352410","full_name":"docker-nginx-static/docker-nginx-static","owner":"docker-nginx-static","description":"Super Lightweight Nginx Image","archived":false,"fork":false,"pushed_at":"2025-02-06T05:44:26.000Z","size":101,"stargazers_count":135,"open_issues_count":3,"forks_count":37,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-02-06T06:29:48.091Z","etag":null,"topics":["docker","nginx","static-server"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/flashspys/nginx-static/","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docker-nginx-static.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-22T22:11:09.000Z","updated_at":"2025-02-06T05:44:29.000Z","dependencies_parsed_at":"2023-01-16T10:42:21.074Z","dependency_job_id":"d1008188-59d1-4252-8981-41e9daaa9174","html_url":"https://github.com/docker-nginx-static/docker-nginx-static","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-nginx-static%2Fdocker-nginx-static","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-nginx-static%2Fdocker-nginx-static/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-nginx-static%2Fdocker-nginx-static/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docker-nginx-static%2Fdocker-nginx-static/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docker-nginx-static","download_url":"https://codeload.github.com/docker-nginx-static/docker-nginx-static/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247426421,"owners_count":20937124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","nginx","static-server"],"created_at":"2024-08-01T15:01:54.434Z","updated_at":"2025-04-06T02:32:34.402Z","avatar_url":"https://github.com/docker-nginx-static.png","language":"Dockerfile","readme":"[![](https://images.microbadger.com/badges/image/flashspys/nginx-static.svg)](https://microbadger.com/images/flashspys/nginx-static \"Get your own image badge on microbadger.com\") ![](https://img.shields.io/docker/pulls/flashspys/nginx-static.svg)\n\n# Super Lightweight Nginx Image\n\n`docker run -v /absolute/path/to/serve:/static -p 8080:80 flashspys/nginx-static`\n\nThis command exposes an nginx server on port 8080 which serves the folder `/absolute/path/to/serve` from the host.\n\nThe 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**.\n\n### nginx-static via HTTPS\n\nTo serve your static files over HTTPS you must use another reverse proxy. We recommend [træfik](https://traefik.io/) 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.\n\n## nginx-static with docker-compose\nThis is an example entry for a `docker-compose.yaml`\n```yaml\nversion: '3'\nservices:\n  example.org:\n    image: flashspys/nginx-static\n    container_name: example.org\n    ports:\n      - 8080:80\n    volumes: \n      - /path/to/serve:/static\n```\n\n\n## nginx-static with træfik 2.x\n\nTo 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](https://docs.traefik.io/user-guides/docker-compose/basic-example/). \n\nIn the following example, replace everything contained in \\\u003cangle brackets\\\u003e and the domain with your values.\n\n```yaml\nservices:\n  traefik:\n    image: traefik:2.4 # check if there is a newer version\n  # Your traefik config.\n    ...\n  example.org:\n    image: flashspys/nginx-static\n    container_name: example.org\n    expose:\n      - 80\n    labels:\n      - \"traefik.enable=true\"\n      - \"traefik.http.routers.\u003crouter\u003e.rule=Host(`example.org`)\"\n      - \"traefik.http.routers.\u003crouter\u003e.entrypoints=\u003centrypoint\u003e\"\n# If you want to enable SSL, uncomment the following line.\n#      - \"traefik.http.routers.\u003crouter\u003e.tls.certresolver=\u003ccertresolver\u003e\"\n    volumes: \n      - /host/path/to/serve:/static\n```\n\nIf traefik and the nginx-static are in distinct docker-compose.yml files, please make sure that they are in the [same network](https://doc.traefik.io/traefik/routing/providers/docker/#traefikdockernetwork).\n\nFor a traefik 1.7 example look [at an old version of the readme](https://github.com/flashspys/docker-nginx-static/blob/bb46250b032d187cab6029a84335099cc9b4cb0e/README.md)\n\n## nginx-static for multi-stage builds\n\nnginx-static is also suitable for multi-stage builds. This is an example Dockerfile for a static node.js application:\n\n```dockerfile\nFROM node:alpine\nWORKDIR /usr/src/app\nCOPY . /usr/src/app\nRUN npm install \u0026\u0026 npm run build\n\nFROM flashspys/nginx-static\nRUN apk update \u0026\u0026 apk upgrade\nCOPY --from=0 /usr/src/app/dist /static\n```\n\n### Custom nginx config\n\nIn 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](nginx.vh.default.conf).\n\n```dockerfile\n…\nFROM flashspys/nginx-static\nRUN rm -rf /etc/nginx/conf.d/default.conf\nCOPY your-custom-nginx.conf /etc/nginx/conf.d/default.conf\n```\n","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocker-nginx-static%2Fdocker-nginx-static","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocker-nginx-static%2Fdocker-nginx-static","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocker-nginx-static%2Fdocker-nginx-static/lists"}