[
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"daily\"\n    open-pull-requests-limit: 1\n    groups:\n      github-actions:\n        patterns:\n          - \"*\"\n  - package-ecosystem: \"docker\"\n    directory: \"/\"\n    schedule:\n      interval: \"daily\"\n    open-pull-requests-limit: 1\n    groups:\n      docker:\n        patterns:\n          - \"*\"\n"
  },
  {
    "path": ".github/workflows/docker.yml",
    "content": "name: Docker Image\n\non:\n  schedule:\n    - cron: \"0 10 * * *\" # everyday at 10am\n  workflow_dispatch:\n  pull_request:\n    branches: [\"**\"]\n  push:\n    branches: [\"**\"]\n    tags: [\"v*.*.*\"]\n\nenv:\n  platforms: linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6\n\njobs:\n  main:\n    runs-on: ubuntu-22.04\n    timeout-minutes: 10\n    steps:\n      - name: Check out the repo\n        uses: actions/checkout@v6\n        with:\n          ref: ${{ github.head_ref || github.ref }}\n      - name: Set imageName based on the repository name\n        id: step_one\n        run: |\n            imageName=\"${GITHUB_REPOSITORY/docker-/}\"\n            echo $imageName\n            echo \"imageName=$imageName\" >> $GITHUB_ENV\n      - name: Docker meta\n        id: docker_meta\n        uses: docker/metadata-action@v6\n        with:\n          images: ${{ env.imageName }}\n      - name: Set up QEMU\n        uses: docker/setup-qemu-action@v4\n      - name: Set up Docker Buildx\n        uses: docker/setup-buildx-action@v4\n      - name: Login to DockerHub\n        uses: docker/login-action@v4\n        with:\n          username: ${{ secrets.DOCKERHUB_USERNAME }}\n          password: ${{ secrets.DOCKERHUB_TOKEN }}\n\n      - name: Build and push\n        id: docker_build\n        uses: docker/build-push-action@v7\n        with:\n          platforms: ${{ env.platforms }}\n          push: ${{ github.event_name != 'pull_request' }}\n          pull: true\n          tags: ${{ steps.docker_meta.outputs.tags }}\n          labels: ${{ steps.docker_meta.outputs.labels }}\n      - name: Docker Scout\n        id: docker-scout-cves\n        if: ${{ github.event_name != 'pull_request' }}\n        uses: docker/scout-action@v1\n        with:\n          command: cves\n          image: ${{ env.imageName }}:${{ steps.docker_meta.outputs.version }}\n          only-severities: critical,high\n          exit-code: false\n"
  },
  {
    "path": "Dockerfile",
    "content": "FROM nginx:alpine\n\nENV HTPASSWD='foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.' \\\n    FORWARD_PORT=80 \\\n    FORWARD_HOST=web\n\nWORKDIR /opt\n\nRUN apk add --no-cache gettext\n\nCOPY auth.conf auth.htpasswd launch.sh ./\n\n# make sure root login is disabled\nRUN sed -i -e 's/^root::/root:!:/' /etc/shadow\n\nCMD [\"./launch.sh\"]\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2016-2021 Maik Hummel (beevelop)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/beevelop/docker-nginx-basic-auth/docker.yml?style=for-the-badge)\n![Docker Pulls](https://img.shields.io/docker/pulls/beevelop/nginx-basic-auth.svg?style=for-the-badge)\n![Docker Stars](https://img.shields.io/docker/stars/beevelop/nginx-basic-auth?style=for-the-badge)\n![Docker Image Size (tag)](https://img.shields.io/docker/image-size/beevelop/nginx-basic-auth/latest?style=for-the-badge)\n![License](https://img.shields.io/github/license/beevelop/docker-nginx-basic-auth?style=for-the-badge)\n[![GitHub release](https://img.shields.io/github/release/beevelop/docker-nginx-basic-auth.svg?style=for-the-badge)](https://github.com/beevelop/docker-nginx-basic-auth/releases)\n![GitHub Release Date](https://img.shields.io/github/release-date/beevelop/docker-nginx-basic-auth?style=for-the-badge)\n![CalVer](https://img.shields.io/badge/CalVer-YYYY.MM.MICRO-22bfda.svg?style=for-the-badge)\n[![Beevelop](https://img.shields.io/badge/-%20Made%20with%20%F0%9F%8D%AF%20by%20%F0%9F%90%9Dvelop-blue.svg?style=for-the-badge)](https://beevelop.com)\n\n# Docker Nginx Basic Auth - Simple Authentication Proxy\n\n> Lightweight nginx reverse proxy with HTTP basic authentication for securing Docker containers and web applications.\n\n## Quickstart\n\n```bash\ndocker run -d --name web dockercloud/hello-world\ndocker run -d -p 80:80 --link web:web --name auth beevelop/nginx-basic-auth\n```\n\nTry accessing and logging in with username `foo` and password `bar`.\n\n## Advanced\n\n```bash\ndocker run -d \\\n           -e HTPASSWD='foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.' \\\n           -e FORWARD_PORT=1337 \\\n           --link web:web -p 8080:80 \\\n           --name auth \\\n           beevelop/nginx-basic-auth\n```\n\n> Use single quotes to prevent unwanted interpretation of `$` signs!\n\n## Configuration\n\n- `HTPASSWD` (default: `foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.`): Will be written to the .htpasswd file on launch (non-persistent)\n- `FORWARD_PORT` (default: `80`): Port of the **source** container that should be forwarded\n- `FORWARD_HOST` (default: `web`): Hostname of the **source** container that should be forwarded\n  > The container does not need any volumes to be mounted! Nonetheless you will find all interesting files at `/etc/nginx/*`.\n\n## Multiple Users\n\nMultiple Users are possible by separating the users by newline. To pass the newlines properly you need to use Shell Quoting (like `$'foo\\nbar'`):\n\n```\ndocker run -d --link web:web --name auth \\\n           -e HTPASSWD=$'foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.\\ntest:$apr1$LKkW8P4Y$P1X/r2YyaexhVL1LzZAQm.' \\\n           beevelop/nginx-basic-auth\n```\n\nresults in 2 users (`foo:bar` and `test:test`).\n\n## Troubleshooting\n\n**Error: `nginx: [emerg] host not found in upstream \"web\"`**\n- Ensure you link the container as `web` using `--link foobar:web`\n\n## Limitations\n\n- SSL/HTTPS is not currently supported\n- For SSL requirements, consider using `jwilder/nginx-proxy` as a central gateway with `VIRTUAL_HOST` environment variable\n\n---\n\n# All Docker Images\n\n| Badge | Pulls | Build Status | Release Date | Release |\n| --- | --- | --- | --- | --- |\n| [![base](https://img.shields.io/badge/beevelop%2Fbase-grey?style=flat-square&logo=github)](https://github.com/beevelop/docker-base) | ![Docker Pulls](https://img.shields.io/docker/pulls/beevelop/base.svg?style=flat-square) | ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/beevelop/docker-base/docker.yml?style=flat-square) | ![GitHub Release Date](https://img.shields.io/github/release-date/beevelop/docker-base?style=flat-square) | ![GitHub release](https://img.shields.io/github/release/beevelop/docker-base.svg?style=flat-square) |\n| [![java](https://img.shields.io/badge/beevelop%2Fjava-grey?style=flat-square&logo=github)](https://github.com/beevelop/docker-java) | ![Docker Pulls](https://img.shields.io/docker/pulls/beevelop/java.svg?style=flat-square) | ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/beevelop/docker-java/docker.yml?style=flat-square) | ![GitHub Release Date](https://img.shields.io/github/release-date/beevelop/docker-java?style=flat-square) | ![GitHub release](https://img.shields.io/github/release/beevelop/docker-java.svg?style=flat-square) |\n| [![android](https://img.shields.io/badge/beevelop%2Fandroid-grey?style=flat-square&logo=github)](https://github.com/beevelop/docker-android) | ![Docker Pulls](https://img.shields.io/docker/pulls/beevelop/android.svg?style=flat-square) | ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/beevelop/docker-android/docker.yml?style=flat-square) | ![GitHub Release Date](https://img.shields.io/github/release-date/beevelop/docker-android?style=flat-square) | ![GitHub release](https://img.shields.io/github/release/beevelop/docker-android.svg?style=flat-square) |\n| [![android-nodejs](https://img.shields.io/badge/beevelop%2Fandroid_nodejs-grey?style=flat-square&logo=github)](https://github.com/beevelop/docker-android-nodejs) | ![Docker Pulls](https://img.shields.io/docker/pulls/beevelop/android-nodejs.svg?style=flat-square) | ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/beevelop/docker-android-nodejs/docker.yml?style=flat-square) | ![GitHub Release Date](https://img.shields.io/github/release-date/beevelop/docker-android-nodejs?style=flat-square) | ![GitHub release](https://img.shields.io/github/release/beevelop/docker-android-nodejs.svg?style=flat-square) |\n| [![cordova](https://img.shields.io/badge/beevelop%2Fcordova-grey?style=flat-square&logo=github)](https://github.com/beevelop/docker-cordova) | ![Docker Pulls](https://img.shields.io/docker/pulls/beevelop/cordova.svg?style=flat-square) | ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/beevelop/docker-cordova/docker.yml?style=flat-square) | ![GitHub Release Date](https://img.shields.io/github/release-date/beevelop/docker-cordova?style=flat-square) | ![GitHub release](https://img.shields.io/github/release/beevelop/docker-cordova.svg?style=flat-square) |\n| [![ionic](https://img.shields.io/badge/beevelop%2Fionic-grey?style=flat-square&logo=github)](https://github.com/beevelop/docker-ionic) | ![Docker Pulls](https://img.shields.io/docker/pulls/beevelop/ionic.svg?style=flat-square) | ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/beevelop/docker-ionic/docker.yml?style=flat-square) | ![GitHub Release Date](https://img.shields.io/github/release-date/beevelop/docker-ionic?style=flat-square) | ![GitHub release](https://img.shields.io/github/release/beevelop/docker-ionic.svg?style=flat-square) |\n| [![nginx-basic-auth](https://img.shields.io/badge/beevelop%2Fnginx_basic_auth-grey?style=flat-square&logo=github)](https://github.com/beevelop/docker-nginx-basic-auth) | ![Docker Pulls](https://img.shields.io/docker/pulls/beevelop/nginx-basic-auth.svg?style=flat-square) | ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/beevelop/docker-nginx-basic-auth/docker.yml?style=flat-square) | ![GitHub Release Date](https://img.shields.io/github/release-date/beevelop/docker-nginx-basic-auth?style=flat-square) | ![GitHub release](https://img.shields.io/github/release/beevelop/docker-nginx-basic-auth.svg?style=flat-square) |\n\n---\n\n![Beevelop's Docker Image Hierarchy](https://gist.githubusercontent.com/beevelop/b0cddab7209a683c77560d06ff00bc8e/raw/15429ee1d02e2c4dc019b760ca8c7ceff5911b82/hierarchy.png)\n\n### Use tags where possible, because\n\n![One does not simply use latest](https://i.imgflip.com/1fgwxr.jpg)\n"
  },
  {
    "path": "auth.conf",
    "content": "server {\n listen 80 default_server;\n\n location / {\n     auth_basic              \"Restricted\";\n     auth_basic_user_file    auth.htpasswd;\n\n     proxy_pass                          http://${FORWARD_HOST}:${FORWARD_PORT};\n     proxy_read_timeout                  900;\n }\n}\n"
  },
  {
    "path": "auth.htpasswd",
    "content": "${HTPASSWD}"
  },
  {
    "path": "docker-stack.yml",
    "content": "version: '3.1'\n\n# run with docker-compose:\n#\n#     docker-compose -f docker-stack.yml up\n\n# run with docker swarm:\n#\n#     docker swarm init\n#     docker stack deploy --compose-file docker-stack.yml authdemo\n\nvolumes:\n  web-data:\n\nservices:\n\n  web:\n    image: 'nginx'\n    ## instead of an exposed port, use FORWARD_PORT in auth, below\n    # ports:\n    #   - '80:80'\n    volumes:\n      - web-data:/usr/share/nginx/html:ro\n  \n  auth:\n    image: 'beevelop/nginx-basic-auth'\n    ports:\n      - '8080:80'\n    environment:\n      - PORT=80\n      - FORWARD_HOST=web\n      - FORWARD_PORT=80\n      ## escape $ with $$ in Docker yml due to variable expansion\n      ## example user/pass generated with htpasswd is foo:bar\n      - HTPASSWD=foo:$$apr1$$odHl5EJN$$KbxMfo86Qdve2FH4owePn.\n"
  },
  {
    "path": "launch.sh",
    "content": "#!/bin/sh\n\nrm /etc/nginx/conf.d/default.conf || :\nenvsubst < auth.conf > /etc/nginx/conf.d/auth.conf\nenvsubst < auth.htpasswd > /etc/nginx/auth.htpasswd\n\nexec nginx -g \"daemon off;\"\n"
  }
]