{"id":16366602,"url":"https://github.com/steebchen/nginx-spa","last_synced_at":"2025-03-21T01:30:40.302Z","repository":{"id":53520021,"uuid":"148788218","full_name":"steebchen/nginx-spa","owner":"steebchen","description":"An alpine-based nginx image for single page applications (SPA)","archived":false,"fork":false,"pushed_at":"2024-05-17T11:18:47.000Z","size":5,"stargazers_count":33,"open_issues_count":1,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T19:38:45.684Z","etag":null,"topics":["alpine","angular","angularjs","deployment","docker","docker-image","dockerfile","hash","history-api","html5-history","nginx","react","reactjs","routing","single-page-applications","spa","spas","svelte","vue","vuejs"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/steebchen/nginx-spa/","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steebchen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-09-14T12:54:32.000Z","updated_at":"2025-01-17T01:45:38.000Z","dependencies_parsed_at":"2024-10-28T09:25:03.257Z","dependency_job_id":null,"html_url":"https://github.com/steebchen/nginx-spa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steebchen%2Fnginx-spa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steebchen%2Fnginx-spa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steebchen%2Fnginx-spa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steebchen%2Fnginx-spa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steebchen","download_url":"https://codeload.github.com/steebchen/nginx-spa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244721040,"owners_count":20498885,"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":["alpine","angular","angularjs","deployment","docker","docker-image","dockerfile","hash","history-api","html5-history","nginx","react","reactjs","routing","single-page-applications","spa","spas","svelte","vue","vuejs"],"created_at":"2024-10-11T02:47:02.541Z","updated_at":"2025-03-21T01:30:40.038Z","avatar_url":"https://github.com/steebchen.png","language":"Dockerfile","readme":"# NGINX Docker image for SPAs\n\n[![docker pull steebchen/nginx-spa][image shield]][docker hub]\n\nThis docker image can be used for single page apps (SPAs) in history mode. It serves your index.html if no other file matches.\n\n## Quickstart\n\nTo create your own dockerfile, simply copy your distribution folder (often `dist/` or `build/`) to `/app` into the image.\n\n```Dockerfile\n# append the following in your existing dockerfile\n# this will create a multi-stage docker build for minimizing size and security vulnerabilities\n# ...\n\nFROM steebchen/nginx-spa:stable\n\n# adapt the `dist/` folder to the output directory your build tool uses (such as `dist/`, `build/` or `www/`).\nCOPY dist/ /app\n\nEXPOSE 80\n\nCMD [\"nginx\"]\n```\n\nSimply run your container as follows:\n\n```bash\ndocker build -t your-app .\ndocker run -p 8000:80 your-app\n```\n\nNow you can visit `http://localhost:8000/` in your browser or run `curl -v http://localhost:8000/` to check if it's working.\n\n## What it does\n\nSingle page applications (SPAs) often use the [HTML5 history API][history api]. This results in neat urls like `/user/john`, but will result in a 404 when accessed directly in the browser.\n\nThis means you have to configure your webserver to serve your entrypoint (index.html) on all routes per default, which es exactly what this docker image does.\n\nAdditionally, routes containing a dot will default to a 404 to prevent sending the index.html for routes like `/static/asset.js`.\nThis is super useful, but may break your app if you have app urls with dots in it (which I doubt).\n\nFiles including a dot will also have a Cache-Control header set to instruct browsers to cache content for 30 days. This is perfect if you're using webpack or similar frameworks which usually makes use of creating files with hashes in their names, but if your static files will be just named \"bundle.js\" or \"0.css\" (index.html is fine of course) you should avoid this image.\n\n## Supported tags and `dockerfile` links\n\n- [`stable` (*dockerfile*)][stable] (recommended)\n- [`latest` (*dockerfile*)][latest]\n\n## Notes\n\n- Gzip is enabled for html, xml, js and css\n- A default public caching header is set\n- The nginx daemon is turned off in the settings\n\n[history api]: https://developer.mozilla.org/en-US/docs/Web/API/History_API\n[latest]: https://github.com/steebchen/nginx-spa/blob/master/dockerfile\n[stable]: https://github.com/steebchen/nginx-spa/blob/stable/dockerfile\n[base image]: https://github.com/nginxinc/docker-nginx\n[image shield]: https://img.shields.io/badge/dockerhub-steebchen%2Fnginx--spa-blue.svg\n[docker hub]: https://registry.hub.docker.com/u/steebchen/nginx-spa/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteebchen%2Fnginx-spa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteebchen%2Fnginx-spa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteebchen%2Fnginx-spa/lists"}