From 2e60ddf60328a6c11d720053600060ea3d75cc6e Mon Sep 17 00:00:00 2001 From: Shane <6071159+smashedr@users.noreply.github.com> Date: Tue, 20 Jan 2026 13:21:24 -0800 Subject: [PATCH] Use Dynamic ERROR_PAGE --- .github/ISSUE_TEMPLATE/0-bug.yaml | 35 +++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/1-feature.yaml | 25 +++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 9 +++++++ .github/workflows/build.yaml | 1 + .github/workflows/lint.yaml | 10 +++++++- .github/workflows/release.yaml | 1 + .prettierrc.json | 1 + README.md | 24 ++++++++++-------- src/10-setup.sh | 3 +++ src/nginx.conf | 2 +- 10 files changed, 99 insertions(+), 12 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/0-bug.yaml create mode 100644 .github/ISSUE_TEMPLATE/1-feature.yaml create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/0-bug.yaml b/.github/ISSUE_TEMPLATE/0-bug.yaml new file mode 100644 index 0000000..7f1f7d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/0-bug.yaml @@ -0,0 +1,35 @@ +name: "⚠️ Report an Issue" +description: "Please let us know if something is not right..." +labels: ["bug"] +assignees: + - smashedr + +body: + - type: markdown + attributes: + value: | + All issues will be responded too. + + - type: textarea + id: description + validations: + required: true + attributes: + label: Details + description: Please describe the issue you are experiencing and how to reproduce. + placeholder: Provide as many details as you can... + + - type: textarea + id: logs + validations: + required: false + attributes: + label: Log Output + description: Paste any relevant logs or output in this box. + placeholder: Output is automatically wrapped in a code block. + render: shell + + - type: markdown + attributes: + value: | + Thank you for taking the time to make this report! diff --git a/.github/ISSUE_TEMPLATE/1-feature.yaml b/.github/ISSUE_TEMPLATE/1-feature.yaml new file mode 100644 index 0000000..17752de --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1-feature.yaml @@ -0,0 +1,25 @@ +name: "💡 Request a Feature" +description: "Request new features or enhancements" +labels: ["enhancement"] +assignees: + - smashedr + +body: + - type: markdown + attributes: + value: | + All requests will be responded too. + + - type: textarea + id: description + validations: + required: true + attributes: + label: Details + description: Please describe the feature or enhancement you are requesting and what it should do. + placeholder: Provide as many details as you can... + + - type: markdown + attributes: + value: | + Thank you for taking the time to make this report! diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..b063520 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,9 @@ +blank_issues_enabled: true +contact_links: + - name: "❔ Start a Discussion" + about: Ask a general question or start a discussion + url: https://github.com/cssnr/docker-nginx-static/discussions/new?category=q-a + + - name: "💬 Join Discord" + about: Chat with us about anything + url: https://discord.gg/wXy6m2X8wY diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 92504db..c27430e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -101,3 +101,4 @@ jobs: uses: sarisia/actions-status-discord@eb045afee445dc055c18d3d90bd0f244fd062708 # v1.16.0 with: webhook: ${{ secrets.DISCORD_WEBHOOK }} + description: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 8999761..a61b0ec 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -45,9 +45,17 @@ jobs: if: ${{ !cancelled() }} uses: cssnr/actionlint-action@v1 - - name: "Hadolint" + - name: "hadolint" if: ${{ !cancelled() }} uses: hadolint/hadolint-action@2332a7b74a6de0dda2e2221d575162eba76ba5e5 # v3.3.0 with: dockerfile: src/Dockerfile ignore: DL3018 + + - name: "shellcheck" + if: ${{ !cancelled() }} + uses: ludeeus/action-shellcheck@master + env: + SHELLCHECK_OPTS: -x + with: + scandir: src diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f74ffe8..1196103 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,3 +25,4 @@ jobs: uses: sarisia/actions-status-discord@eb045afee445dc055c18d3d90bd0f244fd062708 # v1.16.0 with: webhook: ${{ secrets.DISCORD_WEBHOOK }} + description: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/.prettierrc.json b/.prettierrc.json index 34dae84..18fb401 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -6,6 +6,7 @@ { "files": ["**/*.html", "**/*.yaml", "**/*.yml"], "options": { + "printWidth": 119, "singleQuote": false } }, diff --git a/README.md b/README.md index b938fe0..bb6a3d2 100644 --- a/README.md +++ b/README.md @@ -19,16 +19,19 @@ # Docker Nginx Static -Docker Static Web Server +Docker Nginx Static Web Server. -Coming Soon... +```shell +cd directory-to-serve +docker run --rm -p 80:80 -v "$(pwd):/static" ghcr.io/cssnr/docker-nginx-static:latest +``` ## Options | Variable | Default | Description of Environment Variable | | :---------- | :--------------------: | :------------------------------------------------- | -| STATIC | /static | Nginx root directory | -| SUID | 1000 | Directory group/user ID | +| STATIC | `/static` | Nginx root directory | +| SUID | `1000` | Directory group/user ID | | NGINX_INDEX | `index.html index.htm` | Nginx directory index files | | ERROR_PAGE | `/404.html` | Nginx 404 page, set `off` to disable | | GZIP_TYPES | `*` | Nginx gzip_types, set `off` to disable | @@ -58,29 +61,30 @@ For examples see: - [docker-compose.yaml](docker-compose.yaml) - [docker-compose-swarm.yaml](docker-compose-swarm.yaml) -## Support +# Support Please let us know if you run into any [issues](https://github.com/cssnr/docker-nginx-static/issues) or want to see [new features](https://github.com/cssnr/docker-nginx-static/discussions/categories/feature-requests)... -For general help or to request a feature: +For general help or to request a feature, see: - Q&A Discussion: https://github.com/cssnr/docker-nginx-static/discussions/categories/q-a - Request a Feature: https://github.com/cssnr/docker-nginx-static/discussions/categories/feature-requests +- Chat with us on Discord: https://discord.gg/wXy6m2X8wY -If you are experiencing an issue/bug or getting unexpected results: +If you are experiencing an issue/bug or getting unexpected results, you can: - Report an Issue: https://github.com/cssnr/docker-nginx-static/issues +- Provide General Feedback: [https://cssnr.github.io/feedback/](https://cssnr.github.io/feedback/?app=actions-tools) - Chat with us on Discord: https://discord.gg/wXy6m2X8wY -- Provide General Feedback: [https://cssnr.github.io/feedback/](https://cssnr.github.io/feedback/) # Contributing +If you would like to submit a PR, please review the [CONTRIBUTING.md](#contributing-ov-file). + Please consider making a donation to support the development of this project and [additional](https://cssnr.com/) open source projects. [![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cssnr) -If you would like to submit a PR, please review the [CONTRIBUTING.md](#contributing-ov-file). - For a full list of current projects visit: [https://cssnr.github.io/](https://cssnr.github.io/) diff --git a/src/10-setup.sh b/src/10-setup.sh index 3e8cfc3..42f2a4d 100644 --- a/src/10-setup.sh +++ b/src/10-setup.sh @@ -33,6 +33,9 @@ fi if [ "${ERROR_PAGE}" != "off" ];then echo "ERROR_PAGE: ${ERROR_PAGE}" echo "error_page 404 ${ERROR_PAGE};" >> /etc/nginx/conf.d/location.auth.conf + sed "s,ERROR_PAGE,${ERROR_PAGE},g" -i /etc/nginx/nginx.conf +else + sed "s/ERROR_PAGE//g" -i /etc/nginx/nginx.conf fi if [ -n "${BASIC_AUTH}" ];then diff --git a/src/nginx.conf b/src/nginx.conf index f26f9b4..94d9190 100644 --- a/src/nginx.conf +++ b/src/nginx.conf @@ -26,7 +26,7 @@ http { root /static; index NGINX_INDEX; autoindex on; - try_files $uri $uri.html $uri/ /404.html =404; + try_files $uri $uri.html $uri/ ERROR_PAGE =404; include /etc/nginx/conf.d/location.*; } }