├── .github ├── auto-merge.yml ├── dependabot.yml └── workflows │ ├── auto-merge-on-demand.yml │ ├── auto-merge.yml │ ├── build-and-push.yml │ ├── container-tests.yml │ ├── openshift-pytests.yml │ ├── openshift-tests.yml │ └── pr-metadata.yml ├── .gitignore ├── .gitmodules ├── 1.20 ├── .exclude-c9s ├── .exclude-centos7 ├── .exclude-fedora ├── .exclude-rhel8 ├── Dockerfile ├── Dockerfile.c9s ├── Dockerfile.fedora ├── Dockerfile.rhel7 ├── Dockerfile.rhel8 ├── Dockerfile.rhel9 ├── README.md ├── root │ ├── opt │ │ └── app-root │ │ │ ├── etc │ │ │ ├── generate_container_user │ │ │ ├── passwd.template │ │ │ └── scl_enable │ │ │ ├── nginxconf-rhscl.sed │ │ │ └── nginxconf.sed │ └── usr │ │ └── share │ │ └── container-scripts │ │ └── nginx │ │ └── common.sh ├── s2i │ └── bin │ │ ├── assemble │ │ ├── run │ │ └── usage └── test │ ├── examples │ ├── imagestreams │ ├── perl-test-app │ ├── index.html │ ├── nginx-perl │ │ └── Version.pm │ └── nginx.conf │ ├── run │ ├── run-openshift-pytest │ ├── run-openshift-remote-cluster │ ├── start-hook-test-app │ ├── index.html │ ├── index2.html │ ├── nginx-cfg │ │ └── default.conf │ └── nginx-start │ │ └── init.sh │ ├── test-app │ ├── test-lib-nginx.sh │ ├── test-lib-openshift.sh │ ├── test-lib-remote-openshift.sh │ ├── test-lib.sh │ ├── test-openshift.yaml │ ├── test_nginx_imagestream_s2i.py │ ├── test_nginx_imagestreams.py │ ├── test_nginx_local_example.py │ ├── test_nginx_remote_example.py │ ├── test_shared_helm_nginx_imagestreams.py │ └── test_shared_helm_nginx_template.py ├── 1.22-micro ├── .exclude-fedora ├── Dockerfile.c9s ├── Dockerfile.fedora ├── Dockerfile.rhel8 ├── README.md ├── core-scripts ├── root ├── s2i └── test ├── 1.22 ├── .exclude-c9s ├── .exclude-fedora ├── Dockerfile.c9s ├── Dockerfile.fedora ├── Dockerfile.rhel8 ├── Dockerfile.rhel9 ├── README.md ├── root │ ├── opt │ │ └── app-root │ │ │ ├── etc │ │ │ ├── generate_container_user │ │ │ ├── passwd.template │ │ │ └── scl_enable │ │ │ ├── nginxconf-rhscl.sed │ │ │ └── nginxconf.sed │ └── usr │ │ └── share │ │ └── container-scripts │ │ └── nginx │ │ └── common.sh ├── s2i │ └── bin │ │ ├── assemble │ │ ├── run │ │ └── usage └── test │ ├── examples │ ├── imagestreams │ ├── perl-test-app │ ├── index.html │ ├── nginx-perl │ │ └── Version.pm │ └── nginx.conf │ ├── run │ ├── run-openshift-pytest │ ├── run-openshift-remote-cluster │ ├── start-hook-test-app │ ├── index.html │ ├── index2.html │ ├── nginx-cfg │ │ └── default.conf │ └── nginx-start │ │ └── init.sh │ ├── test-app │ ├── test-lib-nginx.sh │ ├── test-lib-openshift.sh │ ├── test-lib-remote-openshift.sh │ ├── test-lib.sh │ ├── test-openshift.yaml │ ├── test_nginx_imagestream_s2i.py │ ├── test_nginx_imagestreams.py │ ├── test_nginx_local_example.py │ ├── test_nginx_remote_example.py │ ├── test_shared_helm_nginx_imagestreams.py │ └── test_shared_helm_nginx_template.py ├── 1.24 ├── .exclude-c8s ├── .exclude-fedora ├── Dockerfile.c8s ├── Dockerfile.c9s ├── Dockerfile.fedora ├── Dockerfile.rhel8 ├── Dockerfile.rhel9 ├── README.md ├── root │ ├── opt │ │ └── app-root │ │ │ ├── etc │ │ │ ├── generate_container_user │ │ │ ├── passwd.template │ │ │ └── scl_enable │ │ │ ├── nginxconf-rhscl.sed │ │ │ └── nginxconf.sed │ └── usr │ │ └── share │ │ └── container-scripts │ │ └── nginx │ │ └── common.sh ├── s2i │ └── bin │ │ ├── assemble │ │ ├── run │ │ └── usage └── test │ ├── examples │ ├── imagestreams │ ├── perl-test-app │ ├── index.html │ ├── nginx-perl │ │ └── Version.pm │ └── nginx.conf │ ├── run │ ├── run-openshift-pytest │ ├── run-openshift-remote-cluster │ ├── start-hook-test-app │ ├── index.html │ ├── index2.html │ ├── nginx-cfg │ │ └── default.conf │ └── nginx-start │ │ └── init.sh │ ├── test-app │ ├── test-lib-nginx.sh │ ├── test-lib-openshift.sh │ ├── test-lib-remote-openshift.sh │ ├── test-lib.sh │ ├── test-openshift.yaml │ ├── test_nginx_imagestream_s2i.py │ ├── test_nginx_imagestreams.py │ ├── test_nginx_local_example.py │ ├── test_nginx_remote_example.py │ ├── test_nginx_template_example_app.py │ ├── test_shared_helm_nginx_imagestreams.py │ └── test_shared_helm_nginx_template.py ├── 1.26 ├── .exclude-rhel8 ├── Dockerfile.c10s ├── Dockerfile.c9s ├── Dockerfile.fedora ├── Dockerfile.rhel10 ├── Dockerfile.rhel8 ├── Dockerfile.rhel9 ├── README.md ├── root │ ├── opt │ │ └── app-root │ │ │ ├── etc │ │ │ ├── generate_container_user │ │ │ ├── passwd.template │ │ │ └── scl_enable │ │ │ ├── nginxconf-rhscl.sed │ │ │ └── nginxconf.sed │ └── usr │ │ └── share │ │ └── container-scripts │ │ └── nginx │ │ └── common.sh ├── s2i │ └── bin │ │ ├── assemble │ │ ├── run │ │ └── usage └── test │ ├── examples │ ├── imagestreams │ ├── perl-test-app │ ├── index.html │ ├── nginx-perl │ │ └── Version.pm │ └── nginx.conf │ ├── run │ ├── run-openshift-remote-cluster │ ├── start-hook-test-app │ ├── index.html │ ├── index2.html │ ├── nginx-cfg │ │ └── default.conf │ └── nginx-start │ │ └── init.sh │ ├── test-app │ ├── test-lib-nginx.sh │ ├── test-lib-openshift.sh │ ├── test-lib-remote-openshift.sh │ ├── test-lib.sh │ ├── test-openshift.yaml │ ├── test_nginx_imagestream_s2i.py │ ├── test_nginx_imagestreams.py │ ├── test_nginx_local_example.py │ ├── test_nginx_remote_example.py │ ├── test_nginx_template_example_app.py │ ├── test_shared_helm_nginx_imagestreams.py │ └── test_shared_helm_nginx_template.py ├── LICENSE ├── Makefile ├── README.md ├── core-scripts ├── examples ├── 1.10 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ └── nginx-default-cfg │ │ └── alias.conf ├── 1.12 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ ├── nginx-default-cfg │ │ └── alias.conf │ │ └── nginx.conf ├── 1.14 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ ├── nginx-default-cfg │ │ └── alias.conf │ │ └── nginx.conf ├── 1.16 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ ├── nginx-default-cfg │ │ └── alias.conf │ │ └── nginx.conf ├── 1.18 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ ├── nginx-default-cfg │ │ └── alias.conf │ │ └── nginx.conf ├── 1.20 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ ├── nginx-default-cfg │ │ └── alias.conf │ │ └── nginx.conf ├── 1.22-micro ├── 1.22 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ ├── nginx-default-cfg │ │ └── alias.conf │ │ └── nginx.conf ├── 1.24 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ ├── nginx-default-cfg │ │ └── alias.conf │ │ └── nginx.conf ├── 1.26 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ ├── nginx-default-cfg │ │ └── alias.conf │ │ └── nginx.conf ├── 1.8 │ └── test-app │ │ ├── index.html │ │ ├── index2.html │ │ ├── nginx-cfg │ │ └── default.conf │ │ └── nginx-default-cfg │ │ └── alias.conf ├── Dockerfile ├── Dockerfile.s2i └── README.md ├── imagestreams ├── imagestreams.yaml ├── nginx-centos.json ├── nginx-rhel-aarch64.json └── nginx-rhel.json └── test ├── check_imagestreams.py ├── examples ├── imagestreams ├── run ├── run-openshift-pytest ├── run-openshift-remote-cluster ├── show_all_imagestreams.py ├── test-lib-nginx.sh ├── test-lib-openshift.sh ├── test-lib-remote-openshift.sh ├── test-lib.sh ├── test-openshift.yaml ├── test_nginx_imagestream_s2i.py ├── test_nginx_imagestreams.py ├── test_nginx_local_example.py ├── test_nginx_remote_example.py ├── test_nginx_template_example_app.py ├── test_shared_helm_nginx_imagestreams.py └── test_shared_helm_nginx_template.py /.github/auto-merge.yml: -------------------------------------------------------------------------------- 1 | target-branch: [] 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | version: 2 4 | updates: 5 | - package-ecosystem: gitsubmodule 6 | directory: / 7 | schedule: 8 | interval: weekly 9 | labels: 10 | - 'ready for review' 11 | - package-ecosystem: github-actions 12 | directory: / 13 | schedule: 14 | interval: monthly 15 | labels: 16 | - 'ready for review' 17 | -------------------------------------------------------------------------------- /.github/workflows/auto-merge-on-demand.yml: -------------------------------------------------------------------------------- 1 | name: Auto Merge Scheduled / On Demand 2 | on: 3 | schedule: 4 | # Workflow runs every 45 minutes 5 | - cron: '*/45 * * * *' 6 | workflow_dispatch: 7 | inputs: 8 | pr-number: 9 | description: 'Pull Request number/s ; when not provided, the workflow will run for all open PRs' 10 | required: true 11 | default: '0' 12 | 13 | permissions: 14 | contents: read 15 | 16 | jobs: 17 | # Get all open PRs 18 | gather-pull-requests: 19 | if: github.repository_owner == 'sclorg' 20 | runs-on: ubuntu-latest 21 | 22 | outputs: 23 | pr-numbers: ${{ steps.get-pr-numbers.outputs.result }} 24 | pr-numbers-manual: ${{ steps.parse-manual-input.outputs.result }} 25 | 26 | steps: 27 | - id: get-pr-numbers 28 | if: inputs.pr-number == '0' 29 | name: Get all open PRs 30 | uses: actions/github-script@v7 31 | with: 32 | # !FIXME: this is not working if there is more than 100 PRs opened 33 | script: | 34 | const { data: pullRequests } = await github.rest.pulls.list({ 35 | owner: context.repo.owner, 36 | repo: context.repo.repo, 37 | state: 'open', 38 | per_page: 100 39 | }); 40 | return pullRequests.map(pr => pr.number); 41 | 42 | - id: parse-manual-input 43 | if: inputs.pr-number != '0' 44 | name: Parse manual input 45 | run: | 46 | # shellcheck disable=SC2086 47 | echo "result="[ ${{ inputs.pr-number }} ]"" >> $GITHUB_OUTPUT 48 | shell: bash 49 | 50 | validate-pr: 51 | name: 'Validation of Pull Request #${{ matrix.pr-number }}' 52 | needs: [ gather-pull-requests ] 53 | runs-on: ubuntu-latest 54 | 55 | strategy: 56 | fail-fast: false 57 | matrix: 58 | pr-number: ${{ inputs.pr-number == 0 && fromJSON(needs.gather-pull-requests.outputs.pr-numbers) || fromJSON(needs.gather-pull-requests.outputs.pr-numbers-manual) }} 59 | 60 | permissions: 61 | # required for merging PRs 62 | contents: write 63 | # required for PR comments and setting labels 64 | pull-requests: write 65 | 66 | steps: 67 | - name: Auto Merge wrapper 68 | uses: sclorg/auto-merge-wrapper@v1 69 | with: 70 | pr-number: ${{ matrix.pr-number }} 71 | token: ${{ secrets.GITHUB_TOKEN }} 72 | -------------------------------------------------------------------------------- /.github/workflows/auto-merge.yml: -------------------------------------------------------------------------------- 1 | name: Auto Merge 2 | on: 3 | workflow_run: 4 | workflows: [ Gather Pull Request Metadata ] 5 | types: 6 | - completed 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | download-metadata: 13 | if: > 14 | github.event.workflow_run.event == 'pull_request' && 15 | github.event.workflow_run.conclusion == 'success' 16 | runs-on: ubuntu-latest 17 | 18 | outputs: 19 | pr-metadata: ${{ steps.Artifact.outputs.pr-metadata-json }} 20 | 21 | steps: 22 | - id: Artifact 23 | name: Download Artifact 24 | uses: redhat-plumbers-in-action/download-artifact@v1 25 | with: 26 | name: pr-metadata 27 | 28 | auto-merge: 29 | needs: [ download-metadata ] 30 | runs-on: ubuntu-latest 31 | 32 | permissions: 33 | # required for merging PRs 34 | contents: write 35 | # required for PR comments and setting labels 36 | pull-requests: write 37 | 38 | steps: 39 | - name: Auto Merge wrapper 40 | uses: sclorg/auto-merge-wrapper@v1 41 | with: 42 | pr-metadata: ${{ needs.download-metadata.outputs.pr-metadata }} 43 | token: ${{ secrets.GITHUB_TOKEN }} 44 | -------------------------------------------------------------------------------- /.github/workflows/build-and-push.yml: -------------------------------------------------------------------------------- 1 | name: Build and push container images to quay.io registry 2 | on: 3 | push: 4 | branches: 5 | - master 6 | schedule: 7 | - cron: '0 1 * * 3' 8 | jobs: 9 | build-and-push: 10 | if: github.repository_owner == 'sclorg' 11 | runs-on: ubuntu-latest 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | include: 16 | - version: "1.20" 17 | tag: "c9s" 18 | dockerfile: "Dockerfile.c9s" 19 | registry_namespace: "sclorg" 20 | quayio_username: "QUAY_IMAGE_SCLORG_BUILDER_USERNAME" 21 | quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN" 22 | image_name: "nginx-120-c9s" 23 | 24 | - version: "1.22-micro" 25 | tag: "c9s" 26 | dockerfile: "Dockerfile.c9s" 27 | registry_namespace: "sclorg" 28 | quayio_username: "QUAY_IMAGE_SCLORG_BUILDER_USERNAME" 29 | quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN" 30 | image_name: "nginx-122-micro-c9s" 31 | 32 | - version: "1.24" 33 | tag: "fedora" 34 | dockerfile: "Dockerfile.fedora" 35 | registry_namespace: "fedora" 36 | quayio_username: "QUAY_IMAGE_FEDORA_BUILDER_USERNAME" 37 | quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN" 38 | image_name: "nginx-124" 39 | 40 | - version: "1.26" 41 | tag: "fedora" 42 | dockerfile: "Dockerfile.fedora" 43 | registry_namespace: "fedora" 44 | quayio_username: "QUAY_IMAGE_FEDORA_BUILDER_USERNAME" 45 | quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN" 46 | image_name: "nginx-126" 47 | 48 | - version: "1.24" 49 | tag: "c9s" 50 | dockerfile: "Dockerfile.c9s" 51 | registry_namespace: "sclorg" 52 | quayio_username: "QUAY_IMAGE_SCLORG_BUILDER_USERNAME" 53 | quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN" 54 | image_name: "nginx-124-c9s" 55 | 56 | - version: "1.26" 57 | tag: "c10s" 58 | dockerfile: "Dockerfile.c10s" 59 | registry_namespace: "sclorg" 60 | quayio_username: "QUAY_IMAGE_SCLORG_BUILDER_USERNAME" 61 | quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN" 62 | image_name: "nginx-126-c10s" 63 | 64 | steps: 65 | - name: Build and push to quay.io registry 66 | uses: sclorg/build-and-push-action@main 67 | with: 68 | registry: "quay.io" 69 | registry_namespace: ${{ matrix.registry_namespace }} 70 | registry_username: ${{ secrets[matrix.quayio_username] }} 71 | registry_token: ${{ secrets[matrix.quayio_token] }} 72 | dockerfile: ${{ matrix.version }}/${{ matrix.dockerfile }} 73 | tag: ${{ matrix.tag }} 74 | image_name: ${{ matrix.image_name }} 75 | readme: "${{ matrix.version }}/README.md" 76 | quay_application_token: ${{ secrets.QUAY_IMAGE_SCLORG_UPDATE_DESC }} 77 | -------------------------------------------------------------------------------- /.github/workflows/container-tests.yml: -------------------------------------------------------------------------------- 1 | on: 2 | issue_comment: 3 | types: 4 | - created 5 | 6 | jobs: 7 | container-tests: 8 | name: "Container-tests: ${{ matrix.version }} - ${{ matrix.os_test }}" 9 | runs-on: ubuntu-latest 10 | concurrency: 11 | group: container-${{ github.event.issue.number }}-${{ matrix.version }}-${{ matrix.os_test }} 12 | cancel-in-progress: true 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | version: [ "1.20", "1.22", "1.22-micro", "1.24", "1.26" ] 17 | os_test: [ "fedora", "rhel8", "rhel9", "rhel10", "c9s", "c10s", "rhel9-unsubscribed" ] 18 | test_case: [ "container" ] 19 | 20 | if: | 21 | github.event.issue.pull_request 22 | && (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]')) 23 | && contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association) 24 | steps: 25 | - uses: sclorg/tfaga-wrapper@main 26 | with: 27 | os_test: ${{ matrix.os_test }} 28 | version: ${{ matrix.version }} 29 | test_case: ${{ matrix.test_case }} 30 | public_api_key: ${{ secrets.TF_PUBLIC_API_KEY }} 31 | private_api_key: ${{ secrets.TF_INTERNAL_API_KEY }} 32 | -------------------------------------------------------------------------------- /.github/workflows/openshift-pytests.yml: -------------------------------------------------------------------------------- 1 | on: 2 | issue_comment: 3 | types: 4 | - created 5 | jobs: 6 | check-imagestreams: 7 | runs-on: ubuntu-latest 8 | permissions: 9 | contents: read 10 | statuses: write 11 | if: | 12 | github.event.issue.pull_request 13 | && (contains(github.event.comment.body, '[test-openshift-pytest]') || contains(github.event.comment.body, '[test-all]')) 14 | && contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association) 15 | steps: 16 | - uses: sclorg/ci-scripts/ocp-stream-generator@master 17 | with: 18 | ref: "refs/pull/${{ github.event.issue.number }}/head" 19 | 20 | openshift-pytests: 21 | name: "${{ matrix.test_case }} PyTests: ${{ matrix.version }} - ${{ matrix.os_test }}" 22 | runs-on: ubuntu-latest 23 | needs: check-imagestreams 24 | concurrency: 25 | group: ocp-pytest-${{ github.event.issue.number }}-${{ matrix.version }}-${{ matrix.os_test }} 26 | cancel-in-progress: true 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | version: [ "1.20", "1.22", "1.22-micro", "1.24", "1.26" ] 31 | os_test: [ "rhel8", "rhel9", "rhel10" ] 32 | test_case: [ "openshift-pytest" ] 33 | 34 | steps: 35 | - uses: sclorg/tfaga-wrapper@main 36 | with: 37 | os_test: ${{ matrix.os_test }} 38 | version: ${{ matrix.version }} 39 | test_case: ${{ matrix.test_case }} 40 | public_api_key: ${{ secrets.TF_PUBLIC_API_KEY }} 41 | private_api_key: ${{ secrets.TF_INTERNAL_API_KEY }} 42 | -------------------------------------------------------------------------------- /.github/workflows/openshift-tests.yml: -------------------------------------------------------------------------------- 1 | on: 2 | issue_comment: 3 | types: 4 | - created 5 | 6 | jobs: 7 | check-imagestreams: 8 | runs-on: ubuntu-latest 9 | permissions: 10 | contents: read 11 | statuses: write 12 | if: | 13 | github.event.issue.pull_request 14 | && (contains(github.event.comment.body, '[test-openshift]') || contains(github.event.comment.body, '[test-all]')) 15 | && contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association) 16 | steps: 17 | - uses: sclorg/ci-scripts/ocp-stream-generator@master 18 | with: 19 | ref: "refs/pull/${{ github.event.issue.number }}/head" 20 | 21 | openshift-tests: 22 | name: "${{ matrix.test_case }} tests: ${{ matrix.version }} - ${{ matrix.os_test }}" 23 | runs-on: ubuntu-latest 24 | needs: check-imagestreams 25 | concurrency: 26 | group: ocp-${{ github.event.issue.number }}-${{ matrix.version }}-${{ matrix.os_test }} 27 | cancel-in-progress: true 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | version: [ "1.20", "1.22", "1.22-micro", "1.24", "1.26" ] 32 | os_test: [ "rhel8", "rhel9", "rhel10" ] 33 | test_case: [ "openshift-4" ] 34 | steps: 35 | - uses: sclorg/tfaga-wrapper@main 36 | with: 37 | os_test: ${{ matrix.os_test }} 38 | version: ${{ matrix.version }} 39 | test_case: ${{ matrix.test_case }} 40 | public_api_key: ${{ secrets.TF_PUBLIC_API_KEY }} 41 | private_api_key: ${{ secrets.TF_INTERNAL_API_KEY }} 42 | -------------------------------------------------------------------------------- /.github/workflows/pr-metadata.yml: -------------------------------------------------------------------------------- 1 | name: Gather Pull Request Metadata 2 | on: 3 | pull_request: 4 | types: [ opened, reopened, synchronize ] 5 | branches: [ master ] 6 | 7 | permissions: 8 | contents: read 9 | 10 | jobs: 11 | gather-metadata: 12 | if: github.repository_owner == 'sclorg' 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Repository checkout 17 | uses: actions/checkout@v4 18 | 19 | - id: Metadata 20 | name: Gather Pull Request Metadata 21 | uses: redhat-plumbers-in-action/gather-pull-request-metadata@v1 22 | 23 | - name: Upload artifact with gathered metadata 24 | uses: actions/upload-artifact@v4 25 | with: 26 | name: pr-metadata 27 | path: ${{ steps.Metadata.outputs.metadata-file }} 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # help.1 files complied by container-common-scripts from README.md files 2 | */root/help.1 3 | .*image-id* 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "common"] 2 | path = common 3 | url = https://github.com/sclorg/container-common-scripts.git 4 | -------------------------------------------------------------------------------- /1.20/.exclude-c9s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.20/.exclude-c9s -------------------------------------------------------------------------------- /1.20/.exclude-centos7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.20/.exclude-centos7 -------------------------------------------------------------------------------- /1.20/.exclude-fedora: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.20/.exclude-fedora -------------------------------------------------------------------------------- /1.20/.exclude-rhel8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.20/.exclude-rhel8 -------------------------------------------------------------------------------- /1.20/Dockerfile.c9s: -------------------------------------------------------------------------------- 1 | FROM quay.io/sclorg/s2i-base-c9s:c9s 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.20 \ 8 | NGINX_SHORT_VER=120 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="sclorg/${NAME}-${NGINX_SHORT_VER}-c9s" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build quay.io/sclorg/${NAME}-${NGINX_SHORT_VER}-c9s:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | # Modules does not exist 42 | # RUN yum -y module enable nginx:$NGINX_VERSION && \ 43 | RUN INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 44 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 45 | rpm -V $INSTALL_PKGS && \ 46 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 47 | yum -y clean all --enablerepo='*' 48 | 49 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 50 | COPY 1.20/s2i/bin/ $STI_SCRIPTS_PATH 51 | 52 | # Copy extra files to the image. 53 | COPY 1.20/root/ / 54 | 55 | # Changing ownership and user rights to support following use-cases: 56 | # 1) running container on OpenShift, whose default security model 57 | # is to run the container under random UID, but GID=0 58 | # 2) for working root-less container with UID=1001, which does not have 59 | # to have GID=0 60 | # 3) for default use-case, that is running container directly on operating system, 61 | # with default UID and GID (1001:0) 62 | # Supported combinations of UID:GID are thus following: 63 | # UID=1001 && GID=0 64 | # UID=&& GID=0 65 | # UID=1001 && GID= 66 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 69 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 70 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 71 | mkdir -p ${NGINX_LOG_PATH} && \ 72 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 73 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 75 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 76 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 77 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 78 | chmod ug+rw ${NGINX_CONF_PATH} && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 80 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 81 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 82 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 83 | rpm-file-permissions 84 | 85 | USER 1001 86 | 87 | STOPSIGNAL SIGQUIT 88 | 89 | # Not using VOLUME statement since it's not working in OpenShift Online: 90 | # https://github.com/sclorg/httpd-container/issues/30 91 | # VOLUME ["/usr/share/nginx/html"] 92 | # VOLUME ["/var/log/nginx/"] 93 | 94 | CMD $STI_SCRIPTS_PATH/usage 95 | -------------------------------------------------------------------------------- /1.20/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM quay.io/fedora/s2i-core:37 2 | 3 | # nginx 1.20 image. 4 | # 5 | # Volumes: 6 | # * /var/log/nginx/ - Storage for logs 7 | 8 | EXPOSE 8080 9 | EXPOSE 8443 10 | 11 | ENV NAME=nginx \ 12 | NGINX_VERSION=1.20 \ 13 | NGINX_SHORT_VER=120 \ 14 | VERSION=0 \ 15 | ARCH=x86_64 16 | 17 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 18 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 19 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 20 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 21 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 22 | Nginx server image can be extended using source-to-image tool." 23 | 24 | LABEL summary="${SUMMARY}" \ 25 | description="${DESCRIPTION}" \ 26 | io.k8s.description="${DESCRIPTION}" \ 27 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 28 | io.openshift.expose-services="8080:http" \ 29 | io.openshift.expose-services="8443:https" \ 30 | io.openshift.tags="builder,${NAME},${NAME}${NGINX_SHORT_VER}" \ 31 | com.redhat.component="${NAME}" \ 32 | name="fedora/${NAME}-${NGINX_SHORT_VER}" \ 33 | version="${VERSION}" \ 34 | maintainer="SoftwareCollections.org " \ 35 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 36 | usage="s2i build ${FGC}/nginx " 37 | 38 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 39 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 40 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 41 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 42 | NGINX_APP_ROOT=${APP_ROOT} \ 43 | NGINX_LOG_PATH=/var/log/nginx \ 44 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 45 | 46 | RUN dnf install -y gettext hostname && \ 47 | yum -y module enable nginx:$NGINX_VERSION && \ 48 | INSTALL_PKGS="nss_wrapper bind-utils nginx nginx-mod-stream nginx-mod-http-perl" && \ 49 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 50 | rpm -V $INSTALL_PKGS && \ 51 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 52 | dnf clean all 53 | 54 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 55 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 56 | 57 | # Copy extra files to the image. 58 | COPY $NGINX_VERSION/root/ / 59 | 60 | # Changing ownership and user rights to support following use-cases: 61 | # 1) running container on OpenShift, whose default security model 62 | # is to run the container under random UID, but GID=0 63 | # 2) for working root-less container with UID=1001, which does not have 64 | # to have GID=0 65 | # 3) for default use-case, that is running container directly on operating system, 66 | # with default UID and GID (1001:0) 67 | # Supported combinations of UID:GID are thus following: 68 | # UID=1001 && GID=0 69 | # UID=&& GID=0 70 | # UID=1001 && GID= 71 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 72 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 73 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 74 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | mkdir -p ${NGINX_LOG_PATH} && \ 77 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 78 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 79 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 80 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 81 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 82 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 83 | chmod ug+rw ${NGINX_CONF_PATH} && \ 84 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 85 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 86 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 87 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 88 | rpm-file-permissions 89 | 90 | USER 1001 91 | 92 | STOPSIGNAL SIGQUIT 93 | 94 | # Not using VOLUME statement since it's not working in OpenShift Online: 95 | # https://github.com/sclorg/httpd-container/issues/30 96 | # VOLUME ["/usr/share/nginx/html"] 97 | # VOLUME ["/var/log/nginx/"] 98 | 99 | CMD $STI_SCRIPTS_PATH/usage 100 | -------------------------------------------------------------------------------- /1.20/Dockerfile.rhel8: -------------------------------------------------------------------------------- 1 | FROM ubi8/s2i-core:1 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.20 \ 8 | NGINX_SHORT_VER=120 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="ubi8/${NAME}-${NGINX_SHORT_VER}" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build ubi8/${NAME}-${NGINX_SHORT_VER}:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 42 | INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 43 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | yum -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY 1.20/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY 1.20/root/ / 53 | 54 | 55 | # Changing ownership and user rights to support following use-cases: 56 | # 1) running container on OpenShift, whose default security model 57 | # is to run the container under random UID, but GID=0 58 | # 2) for working root-less container with UID=1001, which does not have 59 | # to have GID=0 60 | # 3) for default use-case, that is running container directly on operating system, 61 | # with default UID and GID (1001:0) 62 | # Supported combinations of UID:GID are thus following: 63 | # UID=1001 && GID=0 64 | # UID=&& GID=0 65 | # UID=1001 && GID= 66 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 69 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 70 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 71 | mkdir -p ${NGINX_LOG_PATH} && \ 72 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 73 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 75 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 76 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 77 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 78 | chmod ug+rw ${NGINX_CONF_PATH} && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 80 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 81 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 82 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 83 | rpm-file-permissions 84 | 85 | USER 1001 86 | 87 | STOPSIGNAL SIGQUIT 88 | 89 | # Not using VOLUME statement since it's not working in OpenShift Online: 90 | # https://github.com/sclorg/httpd-container/issues/30 91 | # VOLUME ["/usr/share/nginx/html"] 92 | # VOLUME ["/var/log/nginx/"] 93 | 94 | CMD $STI_SCRIPTS_PATH/usage 95 | -------------------------------------------------------------------------------- /1.20/Dockerfile.rhel9: -------------------------------------------------------------------------------- 1 | FROM ubi9/s2i-core:1 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.20 \ 8 | NGINX_SHORT_VER=120 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="ubi9/${NAME}-${NGINX_SHORT_VER}" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build ubi9/${NAME}-${NGINX_SHORT_VER}:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | RUN INSTALL_PKGS="nss_wrapper bind9.18-utils gettext hostname nginx nginx-all-modules" && \ 42 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 43 | rpm -V $INSTALL_PKGS && \ 44 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 45 | yum -y clean all --enablerepo='*' 46 | 47 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 48 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 49 | 50 | # Copy extra files to the image. 51 | COPY $NGINX_VERSION/root/ / 52 | 53 | # Changing ownership and user rights to support following use-cases: 54 | # 1) running container on OpenShift, whose default security model 55 | # is to run the container under random UID, but GID=0 56 | # 2) for working root-less container with UID=1001, which does not have 57 | # to have GID=0 58 | # 3) for default use-case, that is running container directly on operating system, 59 | # with default UID and GID (1001:0) 60 | # Supported combinations of UID:GID are thus following: 61 | # UID=1001 && GID=0 62 | # UID=&& GID=0 63 | # UID=1001 && GID= 64 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 65 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 68 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 69 | mkdir -p ${NGINX_LOG_PATH} && \ 70 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 71 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 72 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 74 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 75 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 76 | chmod ug+rw ${NGINX_CONF_PATH} && \ 77 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 79 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 80 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 81 | rpm-file-permissions 82 | 83 | USER 1001 84 | 85 | STOPSIGNAL SIGQUIT 86 | 87 | # Not using VOLUME statement since it's not working in OpenShift Online: 88 | # https://github.com/sclorg/httpd-container/issues/30 89 | # VOLUME ["/usr/share/nginx/html"] 90 | # VOLUME ["/var/log/nginx/"] 91 | 92 | CMD $STI_SCRIPTS_PATH/usage 93 | -------------------------------------------------------------------------------- /1.20/root/opt/app-root/etc/generate_container_user: -------------------------------------------------------------------------------- 1 | # Set current user in nss_wrapper 2 | PASSWD_DIR="/opt/app-root/etc" 3 | 4 | export USER_ID=$(id -u) 5 | export GROUP_ID=$(id -g) 6 | envsubst < ${PASSWD_DIR}/passwd.template > ${PASSWD_DIR}/passwd 7 | export LD_PRELOAD=libnss_wrapper.so 8 | export NSS_WRAPPER_PASSWD=${PASSWD_DIR}/passwd 9 | export NSS_WRAPPER_GROUP=/etc/group 10 | -------------------------------------------------------------------------------- /1.20/root/opt/app-root/etc/passwd.template: -------------------------------------------------------------------------------- 1 | root:x:0:0:root:/root:/bin/bash 2 | bin:x:1:1:bin:/bin:/sbin/nologin 3 | daemon:x:2:2:daemon:/sbin:/sbin/nologin 4 | adm:x:3:4:adm:/var/adm:/sbin/nologin 5 | lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin 6 | sync:x:5:0:sync:/sbin:/bin/sync 7 | shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown 8 | halt:x:7:0:halt:/sbin:/sbin/halt 9 | mail:x:8:12:mail:/var/spool/mail:/sbin/nologin 10 | operator:x:11:0:operator:/root:/sbin/nologin 11 | games:x:12:100:games:/usr/games:/sbin/nologin 12 | ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin 13 | nobody:x:99:99:Nobody:/:/sbin/nologin 14 | default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin 15 | apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin 16 | -------------------------------------------------------------------------------- /1.20/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # This will make scl collection binaries work out of box. 2 | unset BASH_ENV PROMPT_COMMAND ENV 3 | source scl_source enable rh-nginx$NGINX_SHORT_VER 4 | -------------------------------------------------------------------------------- /1.20/root/opt/app-root/nginxconf-rhscl.sed: -------------------------------------------------------------------------------- 1 | /listen/s%80%8080 default_server% 2 | s/^user *nginx;// 3 | s%/etc/opt/rh/rh-nginx120/nginx/conf.d/%/opt/app-root/etc/nginx.d/% 4 | s%/etc/opt/rh/rh-nginx120/nginx/default.d/%/opt/app-root/etc/nginx.default.d/% 5 | s%/opt/rh/rh-nginx120/root/usr/share/nginx/html%/opt/app-root/src% 6 | 7 | # See: https://github.com/sclorg/nginx-container/pull/69 8 | /error_page/d 9 | /40x.html/,+1d 10 | /50x.html/,+1d 11 | -------------------------------------------------------------------------------- /1.20/root/opt/app-root/nginxconf.sed: -------------------------------------------------------------------------------- 1 | /listen/s%80%8080 default_server% 2 | s/^user *nginx;// 3 | s%/etc/nginx/conf.d/%/opt/app-root/etc/nginx.d/% 4 | s%/etc/nginx/default.d/%/opt/app-root/etc/nginx.default.d/% 5 | s%/usr/share/nginx/html%/opt/app-root/src% 6 | 7 | # See: https://github.com/sclorg/nginx-container/pull/69 8 | /error_page/d 9 | /40x.html/,+1d 10 | /50x.html/,+1d 11 | -------------------------------------------------------------------------------- /1.20/root/usr/share/container-scripts/nginx/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # get_matched_files finds file for image extending 4 | function get_matched_files() { 5 | local custom_dir default_dir 6 | custom_dir="$1" 7 | default_dir="$2" 8 | files_matched="$3" 9 | find "$default_dir" -maxdepth 1 -type f -name "$files_matched" -printf "%f\n" 10 | [ -d "$custom_dir" ] && find "$custom_dir" -maxdepth 1 -type f -name "$files_matched" -printf "%f\n" 11 | } 12 | 13 | # process_extending_files process extending files in $1 and $2 directories 14 | # - source all *.sh files 15 | # (if there are files with same name source only file from $1) 16 | function process_extending_files() { 17 | local custom_dir default_dir 18 | custom_dir=$1 19 | default_dir=$2 20 | while read filename ; do 21 | if [ $filename ]; then 22 | echo "=> sourcing $filename ..." 23 | # Custom file is prefered 24 | if [ -f $custom_dir/$filename ]; then 25 | source $custom_dir/$filename 26 | elif [ -f $default_dir/$filename ]; then 27 | source $default_dir/$filename 28 | fi 29 | fi 30 | done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u)" 31 | } -------------------------------------------------------------------------------- /1.20/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "---> Installing application source" 6 | cp -Rf /tmp/src/. ./ 7 | 8 | # Fix source directory permissions 9 | fix-permissions ./ 10 | 11 | if [ -f ./nginx.conf ]; then 12 | echo "---> Copying nginx.conf configuration file..." 13 | cp -v ./nginx.conf "${NGINX_CONF_PATH}" 14 | rm -f ./nginx.conf 15 | fi 16 | 17 | if [ -d ./nginx-cfg ]; then 18 | echo "---> Copying nginx configuration files..." 19 | if [ "$(ls -A ./nginx-cfg/*.conf)" ]; then 20 | cp -av ./nginx-cfg/*.conf "${NGINX_CONFIGURATION_PATH}" 21 | rm -rf ./nginx-cfg 22 | fi 23 | chmod -Rf g+rw ${NGINX_CONFIGURATION_PATH} 24 | fi 25 | 26 | if [ -d ./nginx-default-cfg ]; then 27 | echo "---> Copying nginx default server configuration files..." 28 | if [ "$(ls -A ./nginx-default-cfg/*.conf)" ]; then 29 | cp -av ./nginx-default-cfg/*.conf "${NGINX_DEFAULT_CONF_PATH}" 30 | rm -rf ./nginx-default-cfg 31 | fi 32 | chmod -Rf g+rw ${NGINX_DEFAULT_CONF_PATH} 33 | fi 34 | 35 | if [ -d ./nginx-start ]; then 36 | echo "---> Copying nginx start-hook scripts..." 37 | if [ "$(ls -A ./nginx-start/* 2>/dev/null)" ]; then 38 | cp -av ./nginx-start/* "${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start/" 39 | rm -rf ./nginx-start 40 | fi 41 | fi 42 | 43 | if [ -d ./nginx-perl ]; then 44 | echo "---> Copying nginx perl module files..." 45 | if [ "$(ls -A ./nginx-perl/*.pm)" ]; then 46 | cp -av ./nginx-perl/*.pm "${NGINX_PERL_MODULE_PATH}" 47 | rm -rf ./nginx-perl 48 | fi 49 | chmod -Rf g+rw ${NGINX_PERL_MODULE_PATH} 50 | fi 51 | -------------------------------------------------------------------------------- /1.20/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source /opt/app-root/etc/generate_container_user 4 | 5 | set -e 6 | 7 | source ${NGINX_CONTAINER_SCRIPTS_PATH}/common.sh 8 | 9 | process_extending_files ${NGINX_APP_ROOT}/src/nginx-start ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start 10 | 11 | if [ ! -v NGINX_LOG_TO_VOLUME -a -v NGINX_LOG_PATH ]; then 12 | /bin/ln -sf /dev/stdout ${NGINX_LOG_PATH}/access.log 13 | /bin/ln -sf /dev/stderr ${NGINX_LOG_PATH}/error.log 14 | fi 15 | 16 | exec nginx -g "daemon off;" 17 | -------------------------------------------------------------------------------- /1.20/s2i/bin/usage: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` 4 | 5 | cat < 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.20/test/perl-test-app/nginx-perl/Version.pm: -------------------------------------------------------------------------------- 1 | package Version; 2 | 3 | use nginx; 4 | 5 | sub installed { 6 | return "$^V"; 7 | } 8 | 9 | sub handler { 10 | my $r = shift; 11 | $r->send_http_header("text/html"); 12 | $r->print("Perl location handler is working"); 13 | return OK; 14 | } 15 | 16 | 1; 17 | __END__ 18 | -------------------------------------------------------------------------------- /1.20/test/perl-test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | perl_modules /opt/app-root/etc/perl; 19 | perl_require Version.pm; 20 | 21 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 22 | '$status $body_bytes_sent "$http_referer" ' 23 | '"$http_user_agent" "$http_x_forwarded_for"'; 24 | 25 | 26 | sendfile on; 27 | tcp_nopush on; 28 | tcp_nodelay on; 29 | keepalive_timeout 65; 30 | types_hash_max_size 2048; 31 | 32 | include /etc/nginx/mime.types; 33 | default_type application/octet-stream; 34 | 35 | perl_set $perl_version Version::installed; 36 | add_header X-Perl-Version $perl_version; 37 | 38 | # Load modular configuration files from the /etc/nginx/conf.d directory. 39 | # See http://nginx.org/en/docs/ngx_core_module.html#include 40 | # for more information. 41 | include /opt/app-root/etc/nginx.d/*.conf; 42 | 43 | server { 44 | listen 8080 default_server; 45 | listen [::]:8080 default_server; 46 | server_name _; 47 | root /opt/app-root/src; 48 | 49 | # Load configuration files for the default server block. 50 | include /opt/app-root/etc/nginx.default.d/*.conf; 51 | 52 | location / { 53 | } 54 | 55 | location /perl { 56 | perl Version::handler; 57 | } 58 | 59 | error_page 404 /404.html; 60 | location = /40x.html { 61 | } 62 | 63 | error_page 500 502 503 504 /50x.html; 64 | location = /50x.html { 65 | } 66 | } 67 | 68 | # Settings for a TLS enabled server. 69 | # 70 | # server { 71 | # listen 443 ssl http2 default_server; 72 | # listen [::]:443 ssl http2 default_server; 73 | # server_name _; 74 | # root /opt/app-root/src; 75 | # 76 | # ssl_certificate "/etc/pki/nginx/server.crt"; 77 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 78 | # ssl_session_cache shared:SSL:1m; 79 | # ssl_session_timeout 10m; 80 | # ssl_ciphers PROFILE=SYSTEM; 81 | # ssl_prefer_server_ciphers on; 82 | # 83 | # # Load configuration files for the default server block. 84 | # include /opt/app-root/etc/nginx.default.d/*.conf; 85 | # 86 | # location / { 87 | # } 88 | # 89 | # error_page 404 /404.html; 90 | # location = /40x.html { 91 | # } 92 | # 93 | # error_page 500 502 503 504 /50x.html; 94 | # location = /50x.html { 95 | # } 96 | # } 97 | 98 | } 99 | 100 | -------------------------------------------------------------------------------- /1.20/test/run: -------------------------------------------------------------------------------- 1 | ../../test/run -------------------------------------------------------------------------------- /1.20/test/run-openshift-pytest: -------------------------------------------------------------------------------- 1 | ../../test/run-openshift-pytest -------------------------------------------------------------------------------- /1.20/test/run-openshift-remote-cluster: -------------------------------------------------------------------------------- 1 | ../../test/run-openshift-remote-cluster -------------------------------------------------------------------------------- /1.20/test/start-hook-test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.20/test/start-hook-test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.20/test/start-hook-test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index ${INDEX_FILE}; 6 | resolver ${DNS_SERVER}; 7 | 8 | } -------------------------------------------------------------------------------- /1.20/test/start-hook-test-app/nginx-start/init.sh: -------------------------------------------------------------------------------- 1 | setup_dns_env_var() { 2 | if [ -z "$DNS_SERVER" ]; then 3 | export DNS_SERVER=`cat /etc/resolv.conf | grep "nameserver " | awk '{print $2}' | tr '\n' ' '` 4 | echo "Using system dns server ${DNS_SERVER}" 5 | else 6 | echo "Using user defined dns server: ${DNS_SERVER}" 7 | fi 8 | } 9 | 10 | inject_env_vars() { 11 | ## Replace only specified environment variables in specified file. 12 | envsubst '${DNS_SERVER},${INDEX_FILE}' < ${NGINX_CONFIGURATION_PATH}/$1 > output.conf 13 | cp output.conf ${NGINX_CONFIGURATION_PATH}/$1 14 | echo "This is $1: " && cat ${NGINX_CONFIGURATION_PATH}/$1 15 | } 16 | 17 | export INDEX_FILE=index2.html 18 | setup_dns_env_var 19 | inject_env_vars "default.conf" 20 | -------------------------------------------------------------------------------- /1.20/test/test-app: -------------------------------------------------------------------------------- 1 | ../../examples/1.20/test-app/ -------------------------------------------------------------------------------- /1.20/test/test-lib-nginx.sh: -------------------------------------------------------------------------------- 1 | ../../test/test-lib-nginx.sh -------------------------------------------------------------------------------- /1.20/test/test-lib-openshift.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib-openshift.sh -------------------------------------------------------------------------------- /1.20/test/test-lib-remote-openshift.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib-remote-openshift.sh -------------------------------------------------------------------------------- /1.20/test/test-lib.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib.sh -------------------------------------------------------------------------------- /1.20/test/test-openshift.yaml: -------------------------------------------------------------------------------- 1 | ../../common/test-openshift.yaml -------------------------------------------------------------------------------- /1.20/test/test_nginx_imagestream_s2i.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_imagestream_s2i.py -------------------------------------------------------------------------------- /1.20/test/test_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_imagestreams.py -------------------------------------------------------------------------------- /1.20/test/test_nginx_local_example.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_local_example.py -------------------------------------------------------------------------------- /1.20/test/test_nginx_remote_example.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_remote_example.py -------------------------------------------------------------------------------- /1.20/test/test_shared_helm_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../../test/test_shared_helm_nginx_imagestreams.py -------------------------------------------------------------------------------- /1.20/test/test_shared_helm_nginx_template.py: -------------------------------------------------------------------------------- 1 | ../../test/test_shared_helm_nginx_template.py -------------------------------------------------------------------------------- /1.22-micro/.exclude-fedora: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.22-micro/.exclude-fedora -------------------------------------------------------------------------------- /1.22-micro/core-scripts: -------------------------------------------------------------------------------- 1 | ../common/shared-scripts/core/ -------------------------------------------------------------------------------- /1.22-micro/root: -------------------------------------------------------------------------------- 1 | ../1.22/root/ -------------------------------------------------------------------------------- /1.22-micro/s2i: -------------------------------------------------------------------------------- 1 | ../1.22/s2i/ -------------------------------------------------------------------------------- /1.22-micro/test: -------------------------------------------------------------------------------- 1 | ../1.22/test/ -------------------------------------------------------------------------------- /1.22/.exclude-c9s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.22/.exclude-c9s -------------------------------------------------------------------------------- /1.22/.exclude-fedora: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.22/.exclude-fedora -------------------------------------------------------------------------------- /1.22/Dockerfile.c9s: -------------------------------------------------------------------------------- 1 | FROM quay.io/sclorg/s2i-base-c9s:c9s 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.22 \ 8 | NGINX_SHORT_VER=122 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="sclorg/${NAME}-${NGINX_SHORT_VER}-c9s" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build quay.io/sclorg/${NAME}-${NGINX_SHORT_VER}-c9s:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | # Modules does not exist 42 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 43 | INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 44 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 45 | rpm -V $INSTALL_PKGS && \ 46 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 47 | yum -y clean all --enablerepo='*' 48 | 49 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 50 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 51 | 52 | # Copy extra files to the image. 53 | COPY $NGINX_VERSION/root/ / 54 | 55 | # Changing ownership and user rights to support following use-cases: 56 | # 1) running container on OpenShift, whose default security model 57 | # is to run the container under random UID, but GID=0 58 | # 2) for working root-less container with UID=1001, which does not have 59 | # to have GID=0 60 | # 3) for default use-case, that is running container directly on operating system, 61 | # with default UID and GID (1001:0) 62 | # Supported combinations of UID:GID are thus following: 63 | # UID=1001 && GID=0 64 | # UID=&& GID=0 65 | # UID=1001 && GID= 66 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 69 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 70 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 71 | mkdir -p ${NGINX_LOG_PATH} && \ 72 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 73 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 75 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 76 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 77 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 78 | chmod ug+rw ${NGINX_CONF_PATH} && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 80 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 81 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 82 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 83 | rpm-file-permissions 84 | 85 | USER 1001 86 | 87 | STOPSIGNAL SIGQUIT 88 | 89 | # Not using VOLUME statement since it's not working in OpenShift Online: 90 | # https://github.com/sclorg/httpd-container/issues/30 91 | # VOLUME ["/usr/share/nginx/html"] 92 | # VOLUME ["/var/log/nginx/"] 93 | 94 | CMD $STI_SCRIPTS_PATH/usage 95 | -------------------------------------------------------------------------------- /1.22/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM quay.io/fedora/s2i-core:37 2 | 3 | # nginx 1.22 image. 4 | # 5 | # Volumes: 6 | # * /var/log/nginx/ - Storage for logs 7 | 8 | EXPOSE 8080 9 | EXPOSE 8443 10 | 11 | ENV NAME=nginx \ 12 | NGINX_VERSION=1.22 \ 13 | NGINX_SHORT_VER=122 \ 14 | VERSION=0 \ 15 | ARCH=x86_64 16 | 17 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 18 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 19 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 20 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 21 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 22 | Nginx server image can be extended using source-to-image tool." 23 | 24 | LABEL summary="${SUMMARY}" \ 25 | description="${DESCRIPTION}" \ 26 | io.k8s.description="${DESCRIPTION}" \ 27 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 28 | io.openshift.expose-services="8080:http" \ 29 | io.openshift.expose-services="8443:https" \ 30 | io.openshift.tags="builder,${NAME},${NAME}${NGINX_SHORT_VER}" \ 31 | com.redhat.component="${NAME}" \ 32 | name="fedora/${NAME}-${NGINX_SHORT_VER}" \ 33 | version="${VERSION}" \ 34 | maintainer="SoftwareCollections.org " \ 35 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 36 | usage="s2i build ${FGC}/nginx " 37 | 38 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 39 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 40 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 41 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 42 | NGINX_APP_ROOT=${APP_ROOT} \ 43 | NGINX_LOG_PATH=/var/log/nginx \ 44 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 45 | 46 | RUN dnf install -y gettext hostname && \ 47 | INSTALL_PKGS="nss_wrapper-libs bind-utils nginx nginx-mod-stream nginx-mod-http-perl" && \ 48 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 49 | rpm -V $INSTALL_PKGS && \ 50 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 51 | dnf clean all 52 | 53 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 54 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 55 | 56 | # Copy extra files to the image. 57 | COPY $NGINX_VERSION/root/ / 58 | 59 | # Changing ownership and user rights to support following use-cases: 60 | # 1) running container on OpenShift, whose default security model 61 | # is to run the container under random UID, but GID=0 62 | # 2) for working root-less container with UID=1001, which does not have 63 | # to have GID=0 64 | # 3) for default use-case, that is running container directly on operating system, 65 | # with default UID and GID (1001:0) 66 | # Supported combinations of UID:GID are thus following: 67 | # UID=1001 && GID=0 68 | # UID=&& GID=0 69 | # UID=1001 && GID= 70 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 71 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 72 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 73 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 74 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 75 | mkdir -p ${NGINX_LOG_PATH} && \ 76 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 77 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 78 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 79 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 82 | chmod ug+rw ${NGINX_CONF_PATH} && \ 83 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 84 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 85 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 86 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 87 | rpm-file-permissions 88 | 89 | USER 1001 90 | 91 | STOPSIGNAL SIGQUIT 92 | 93 | # Not using VOLUME statement since it's not working in OpenShift Online: 94 | # https://github.com/sclorg/httpd-container/issues/30 95 | # VOLUME ["/usr/share/nginx/html"] 96 | # VOLUME ["/var/log/nginx/"] 97 | 98 | CMD $STI_SCRIPTS_PATH/usage 99 | -------------------------------------------------------------------------------- /1.22/Dockerfile.rhel8: -------------------------------------------------------------------------------- 1 | FROM ubi8/s2i-core:1 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.22 \ 8 | NGINX_SHORT_VER=122 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="ubi8/${NAME}-${NGINX_SHORT_VER}" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build ubi8/${NAME}-${NGINX_SHORT_VER}:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 42 | INSTALL_PKGS="nss_wrapper-libs bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 43 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | yum -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY 1.22/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY 1.22/root/ / 53 | 54 | # Changing ownership and user rights to support following use-cases: 55 | # 1) running container on OpenShift, whose default security model 56 | # is to run the container under random UID, but GID=0 57 | # 2) for working root-less container with UID=1001, which does not have 58 | # to have GID=0 59 | # 3) for default use-case, that is running container directly on operating system, 60 | # with default UID and GID (1001:0) 61 | # Supported combinations of UID:GID are thus following: 62 | # UID=1001 && GID=0 63 | # UID=&& GID=0 64 | # UID=1001 && GID= 65 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 69 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 70 | mkdir -p ${NGINX_LOG_PATH} && \ 71 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 72 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 77 | chmod ug+rw ${NGINX_CONF_PATH} && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 82 | rpm-file-permissions 83 | 84 | USER 1001 85 | 86 | STOPSIGNAL SIGQUIT 87 | 88 | # Not using VOLUME statement since it's not working in OpenShift Online: 89 | # https://github.com/sclorg/httpd-container/issues/30 90 | # VOLUME ["/usr/share/nginx/html"] 91 | # VOLUME ["/var/log/nginx/"] 92 | 93 | CMD $STI_SCRIPTS_PATH/usage 94 | -------------------------------------------------------------------------------- /1.22/Dockerfile.rhel9: -------------------------------------------------------------------------------- 1 | FROM ubi9/s2i-core:1 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.22 \ 8 | NGINX_SHORT_VER=122 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="ubi9/${NAME}-${NGINX_SHORT_VER}" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build ubi9/${NAME}-${NGINX_SHORT_VER}:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 42 | INSTALL_PKGS="nss_wrapper-libs bind9.18-utils gettext hostname nginx nginx-all-modules" && \ 43 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | yum -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY $NGINX_VERSION/root/ / 53 | 54 | # Changing ownership and user rights to support following use-cases: 55 | # 1) running container on OpenShift, whose default security model 56 | # is to run the container under random UID, but GID=0 57 | # 2) for working root-less container with UID=1001, which does not have 58 | # to have GID=0 59 | # 3) for default use-case, that is running container directly on operating system, 60 | # with default UID and GID (1001:0) 61 | # Supported combinations of UID:GID are thus following: 62 | # UID=1001 && GID=0 63 | # UID=&& GID=0 64 | # UID=1001 && GID= 65 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 69 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 70 | mkdir -p ${NGINX_LOG_PATH} && \ 71 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 72 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 77 | chmod ug+rw ${NGINX_CONF_PATH} && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 82 | rpm-file-permissions 83 | 84 | USER 1001 85 | 86 | STOPSIGNAL SIGQUIT 87 | 88 | # Not using VOLUME statement since it's not working in OpenShift Online: 89 | # https://github.com/sclorg/httpd-container/issues/30 90 | # VOLUME ["/usr/share/nginx/html"] 91 | # VOLUME ["/var/log/nginx/"] 92 | 93 | CMD $STI_SCRIPTS_PATH/usage 94 | -------------------------------------------------------------------------------- /1.22/root/opt/app-root/etc/generate_container_user: -------------------------------------------------------------------------------- 1 | # Set current user in nss_wrapper 2 | PASSWD_DIR="/opt/app-root/etc" 3 | 4 | export USER_ID=$(id -u) 5 | export GROUP_ID=$(id -g) 6 | envsubst < ${PASSWD_DIR}/passwd.template > ${PASSWD_DIR}/passwd 7 | export LD_PRELOAD=libnss_wrapper.so 8 | export NSS_WRAPPER_PASSWD=${PASSWD_DIR}/passwd 9 | export NSS_WRAPPER_GROUP=/etc/group 10 | -------------------------------------------------------------------------------- /1.22/root/opt/app-root/etc/passwd.template: -------------------------------------------------------------------------------- 1 | root:x:0:0:root:/root:/bin/bash 2 | bin:x:1:1:bin:/bin:/sbin/nologin 3 | daemon:x:2:2:daemon:/sbin:/sbin/nologin 4 | adm:x:3:4:adm:/var/adm:/sbin/nologin 5 | lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin 6 | sync:x:5:0:sync:/sbin:/bin/sync 7 | shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown 8 | halt:x:7:0:halt:/sbin:/sbin/halt 9 | mail:x:8:12:mail:/var/spool/mail:/sbin/nologin 10 | operator:x:11:0:operator:/root:/sbin/nologin 11 | games:x:12:100:games:/usr/games:/sbin/nologin 12 | ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin 13 | nobody:x:99:99:Nobody:/:/sbin/nologin 14 | default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin 15 | apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin 16 | -------------------------------------------------------------------------------- /1.22/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # This will make scl collection binaries work out of box. 2 | unset BASH_ENV PROMPT_COMMAND ENV 3 | source scl_source enable rh-nginx$NGINX_SHORT_VER 4 | -------------------------------------------------------------------------------- /1.22/root/opt/app-root/nginxconf-rhscl.sed: -------------------------------------------------------------------------------- 1 | /listen/s%80%8080 default_server% 2 | s/^user *nginx;// 3 | s%/etc/nginx/conf.d/%/opt/app-root/etc/nginx.d/% 4 | s%/etc/nginx/default.d/%/opt/app-root/etc/nginx.default.d/% 5 | s%/usr/share/nginx/html%/opt/app-root/src% 6 | 7 | # See: https://github.com/sclorg/nginx-container/pull/69 8 | /error_page/d 9 | /40x.html/,+1d 10 | /50x.html/,+1d 11 | -------------------------------------------------------------------------------- /1.22/root/opt/app-root/nginxconf.sed: -------------------------------------------------------------------------------- 1 | /listen/s%80%8080 default_server% 2 | s/^user *nginx;// 3 | s%/etc/nginx/conf.d/%/opt/app-root/etc/nginx.d/% 4 | s%/etc/nginx/default.d/%/opt/app-root/etc/nginx.default.d/% 5 | s%/usr/share/nginx/html%/opt/app-root/src% 6 | 7 | # See: https://github.com/sclorg/nginx-container/pull/69 8 | /error_page/d 9 | /40x.html/,+1d 10 | /50x.html/,+1d 11 | -------------------------------------------------------------------------------- /1.22/root/usr/share/container-scripts/nginx/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # get_matched_files finds file for image extending 4 | function get_matched_files() { 5 | local custom_dir default_dir 6 | custom_dir="$1" 7 | default_dir="$2" 8 | files_matched="$3" 9 | find "$default_dir" -maxdepth 1 -type f -name "$files_matched" -printf "%f\n" 10 | [ -d "$custom_dir" ] && find "$custom_dir" -maxdepth 1 -type f -name "$files_matched" -printf "%f\n" 11 | } 12 | 13 | # process_extending_files process extending files in $1 and $2 directories 14 | # - source all *.sh files 15 | # (if there are files with same name source only file from $1) 16 | function process_extending_files() { 17 | local custom_dir default_dir 18 | custom_dir=$1 19 | default_dir=$2 20 | while read filename ; do 21 | if [ $filename ]; then 22 | echo "=> sourcing $filename ..." 23 | # Custom file is prefered 24 | if [ -f $custom_dir/$filename ]; then 25 | source $custom_dir/$filename 26 | elif [ -f $default_dir/$filename ]; then 27 | source $default_dir/$filename 28 | fi 29 | fi 30 | done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u)" 31 | } -------------------------------------------------------------------------------- /1.22/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "---> Installing application source" 6 | cp -Rf /tmp/src/. ./ 7 | 8 | # Fix source directory permissions 9 | fix-permissions ./ 10 | 11 | if [ -f ./nginx.conf ]; then 12 | echo "---> Copying nginx.conf configuration file..." 13 | cp -v ./nginx.conf "${NGINX_CONF_PATH}" 14 | rm -f ./nginx.conf 15 | fi 16 | 17 | if [ -d ./nginx-cfg ]; then 18 | echo "---> Copying nginx configuration files..." 19 | if [ "$(ls -A ./nginx-cfg/*.conf)" ]; then 20 | cp -av ./nginx-cfg/*.conf "${NGINX_CONFIGURATION_PATH}" 21 | rm -rf ./nginx-cfg 22 | fi 23 | chmod -Rf g+rw ${NGINX_CONFIGURATION_PATH} 24 | fi 25 | 26 | if [ -d ./nginx-default-cfg ]; then 27 | echo "---> Copying nginx default server configuration files..." 28 | if [ "$(ls -A ./nginx-default-cfg/*.conf)" ]; then 29 | cp -av ./nginx-default-cfg/*.conf "${NGINX_DEFAULT_CONF_PATH}" 30 | rm -rf ./nginx-default-cfg 31 | fi 32 | chmod -Rf g+rw ${NGINX_DEFAULT_CONF_PATH} 33 | fi 34 | 35 | if [ -d ./nginx-start ]; then 36 | echo "---> Copying nginx start-hook scripts..." 37 | if [ "$(ls -A ./nginx-start/* 2>/dev/null)" ]; then 38 | cp -av ./nginx-start/* "${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start/" 39 | rm -rf ./nginx-start 40 | fi 41 | fi 42 | 43 | if [ -n "${NGINX_PERL_MODULE_PATH}" ] && [ -d ./nginx-perl ]; then 44 | echo "---> Copying nginx perl module files..." 45 | if [ "$(ls -A ./nginx-perl/*.pm)" ]; then 46 | cp -av ./nginx-perl/*.pm "${NGINX_PERL_MODULE_PATH}" 47 | rm -rf ./nginx-perl 48 | fi 49 | chmod -Rf g+rw ${NGINX_PERL_MODULE_PATH} 50 | fi 51 | -------------------------------------------------------------------------------- /1.22/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source /opt/app-root/etc/generate_container_user 4 | 5 | set -e 6 | 7 | source ${NGINX_CONTAINER_SCRIPTS_PATH}/common.sh 8 | 9 | process_extending_files ${NGINX_APP_ROOT}/src/nginx-start ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start 10 | 11 | if [ ! -v NGINX_LOG_TO_VOLUME -a -v NGINX_LOG_PATH ]; then 12 | /bin/ln -sf /dev/stdout ${NGINX_LOG_PATH}/access.log 13 | /bin/ln -sf /dev/stderr ${NGINX_LOG_PATH}/error.log 14 | fi 15 | 16 | exec nginx -g "daemon off;" 17 | -------------------------------------------------------------------------------- /1.22/s2i/bin/usage: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` 4 | 5 | cat < 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.22/test/perl-test-app/nginx-perl/Version.pm: -------------------------------------------------------------------------------- 1 | package Version; 2 | 3 | use nginx; 4 | 5 | sub installed { 6 | return "$^V"; 7 | } 8 | 9 | sub handler { 10 | my $r = shift; 11 | $r->send_http_header("text/html"); 12 | $r->print("Perl location handler is working"); 13 | return OK; 14 | } 15 | 16 | 1; 17 | __END__ 18 | -------------------------------------------------------------------------------- /1.22/test/perl-test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | perl_modules /opt/app-root/etc/perl; 19 | perl_require Version.pm; 20 | 21 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 22 | '$status $body_bytes_sent "$http_referer" ' 23 | '"$http_user_agent" "$http_x_forwarded_for"'; 24 | 25 | 26 | sendfile on; 27 | tcp_nopush on; 28 | tcp_nodelay on; 29 | keepalive_timeout 65; 30 | types_hash_max_size 2048; 31 | 32 | include /etc/nginx/mime.types; 33 | default_type application/octet-stream; 34 | 35 | perl_set $perl_version Version::installed; 36 | add_header X-Perl-Version $perl_version; 37 | 38 | # Load modular configuration files from the /etc/nginx/conf.d directory. 39 | # See http://nginx.org/en/docs/ngx_core_module.html#include 40 | # for more information. 41 | include /opt/app-root/etc/nginx.d/*.conf; 42 | 43 | server { 44 | listen 8080 default_server; 45 | listen [::]:8080 default_server; 46 | server_name _; 47 | root /opt/app-root/src; 48 | 49 | # Load configuration files for the default server block. 50 | include /opt/app-root/etc/nginx.default.d/*.conf; 51 | 52 | location / { 53 | } 54 | 55 | location /perl { 56 | perl Version::handler; 57 | } 58 | 59 | error_page 404 /404.html; 60 | location = /40x.html { 61 | } 62 | 63 | error_page 500 502 503 504 /50x.html; 64 | location = /50x.html { 65 | } 66 | } 67 | 68 | # Settings for a TLS enabled server. 69 | # 70 | # server { 71 | # listen 443 ssl http2 default_server; 72 | # listen [::]:443 ssl http2 default_server; 73 | # server_name _; 74 | # root /opt/app-root/src; 75 | # 76 | # ssl_certificate "/etc/pki/nginx/server.crt"; 77 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 78 | # ssl_session_cache shared:SSL:1m; 79 | # ssl_session_timeout 10m; 80 | # ssl_ciphers PROFILE=SYSTEM; 81 | # ssl_prefer_server_ciphers on; 82 | # 83 | # # Load configuration files for the default server block. 84 | # include /opt/app-root/etc/nginx.default.d/*.conf; 85 | # 86 | # location / { 87 | # } 88 | # 89 | # error_page 404 /404.html; 90 | # location = /40x.html { 91 | # } 92 | # 93 | # error_page 500 502 503 504 /50x.html; 94 | # location = /50x.html { 95 | # } 96 | # } 97 | 98 | } 99 | 100 | -------------------------------------------------------------------------------- /1.22/test/run: -------------------------------------------------------------------------------- 1 | ../../test/run -------------------------------------------------------------------------------- /1.22/test/run-openshift-pytest: -------------------------------------------------------------------------------- 1 | ../../test/run-openshift-pytest -------------------------------------------------------------------------------- /1.22/test/run-openshift-remote-cluster: -------------------------------------------------------------------------------- 1 | ../../test/run-openshift-remote-cluster -------------------------------------------------------------------------------- /1.22/test/start-hook-test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.22/test/start-hook-test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.22/test/start-hook-test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index ${INDEX_FILE}; 6 | resolver ${DNS_SERVER}; 7 | 8 | } -------------------------------------------------------------------------------- /1.22/test/start-hook-test-app/nginx-start/init.sh: -------------------------------------------------------------------------------- 1 | setup_dns_env_var() { 2 | if [ -z "$DNS_SERVER" ]; then 3 | export DNS_SERVER=`cat /etc/resolv.conf | grep "nameserver " | awk '{print $2}' | tr '\n' ' '` 4 | echo "Using system dns server ${DNS_SERVER}" 5 | else 6 | echo "Using user defined dns server: ${DNS_SERVER}" 7 | fi 8 | } 9 | 10 | inject_env_vars() { 11 | ## Replace only specified environment variables in specified file. 12 | envsubst '${DNS_SERVER},${INDEX_FILE}' < ${NGINX_CONFIGURATION_PATH}/$1 > output.conf 13 | cp output.conf ${NGINX_CONFIGURATION_PATH}/$1 14 | echo "This is $1: " && cat ${NGINX_CONFIGURATION_PATH}/$1 15 | } 16 | 17 | export INDEX_FILE=index2.html 18 | setup_dns_env_var 19 | inject_env_vars "default.conf" 20 | -------------------------------------------------------------------------------- /1.22/test/test-app: -------------------------------------------------------------------------------- 1 | ../../examples/1.22/test-app -------------------------------------------------------------------------------- /1.22/test/test-lib-nginx.sh: -------------------------------------------------------------------------------- 1 | ../../test/test-lib-nginx.sh -------------------------------------------------------------------------------- /1.22/test/test-lib-openshift.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib-openshift.sh -------------------------------------------------------------------------------- /1.22/test/test-lib-remote-openshift.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib-remote-openshift.sh -------------------------------------------------------------------------------- /1.22/test/test-lib.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib.sh -------------------------------------------------------------------------------- /1.22/test/test-openshift.yaml: -------------------------------------------------------------------------------- 1 | ../../common/test-openshift.yaml -------------------------------------------------------------------------------- /1.22/test/test_nginx_imagestream_s2i.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_imagestream_s2i.py -------------------------------------------------------------------------------- /1.22/test/test_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_imagestreams.py -------------------------------------------------------------------------------- /1.22/test/test_nginx_local_example.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_local_example.py -------------------------------------------------------------------------------- /1.22/test/test_nginx_remote_example.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_remote_example.py -------------------------------------------------------------------------------- /1.22/test/test_shared_helm_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../../test/test_shared_helm_nginx_imagestreams.py -------------------------------------------------------------------------------- /1.22/test/test_shared_helm_nginx_template.py: -------------------------------------------------------------------------------- 1 | ../../test/test_shared_helm_nginx_template.py -------------------------------------------------------------------------------- /1.24/.exclude-c8s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.24/.exclude-c8s -------------------------------------------------------------------------------- /1.24/.exclude-fedora: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.24/.exclude-fedora -------------------------------------------------------------------------------- /1.24/Dockerfile.c8s: -------------------------------------------------------------------------------- 1 | FROM quay.io/sclorg/s2i-core-c8s:c8s 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.24 \ 8 | NGINX_SHORT_VER=124 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="sclorg/${NAME}-${NGINX_SHORT_VER}-c8s" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build quay.io/sclorg/${NAME}-${NGINX_SHORT_VER}-c8s:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 42 | INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 43 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | yum -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY $NGINX_VERSION/root/ / 53 | 54 | # Changing ownership and user rights to support following use-cases: 55 | # 1) running container on OpenShift, whose default security model 56 | # is to run the container under random UID, but GID=0 57 | # 2) for working root-less container with UID=1001, which does not have 58 | # to have GID=0 59 | # 3) for default use-case, that is running container directly on operating system, 60 | # with default UID and GID (1001:0) 61 | # Supported combinations of UID:GID are thus following: 62 | # UID=1001 && GID=0 63 | # UID=&& GID=0 64 | # UID=1001 && GID= 65 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 69 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 70 | mkdir -p ${NGINX_LOG_PATH} && \ 71 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 72 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 77 | chmod ug+rw ${NGINX_CONF_PATH} && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 82 | rpm-file-permissions 83 | 84 | USER 1001 85 | 86 | STOPSIGNAL SIGQUIT 87 | 88 | CMD $STI_SCRIPTS_PATH/usage 89 | -------------------------------------------------------------------------------- /1.24/Dockerfile.c9s: -------------------------------------------------------------------------------- 1 | FROM quay.io/sclorg/s2i-core-c9s:c9s 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.24 \ 8 | NGINX_SHORT_VER=124 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="sclorg/${NAME}-${NGINX_SHORT_VER}-c9s" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build quay.io/sclorg/${NAME}-${NGINX_SHORT_VER}-c9s:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | # Modules does not exist 42 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 43 | INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 44 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 45 | rpm -V $INSTALL_PKGS && \ 46 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 47 | yum -y clean all --enablerepo='*' 48 | 49 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 50 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 51 | 52 | # Copy extra files to the image. 53 | COPY $NGINX_VERSION/root/ / 54 | 55 | # Changing ownership and user rights to support following use-cases: 56 | # 1) running container on OpenShift, whose default security model 57 | # is to run the container under random UID, but GID=0 58 | # 2) for working root-less container with UID=1001, which does not have 59 | # to have GID=0 60 | # 3) for default use-case, that is running container directly on operating system, 61 | # with default UID and GID (1001:0) 62 | # Supported combinations of UID:GID are thus following: 63 | # UID=1001 && GID=0 64 | # UID=&& GID=0 65 | # UID=1001 && GID= 66 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 69 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 70 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 71 | mkdir -p ${NGINX_LOG_PATH} && \ 72 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 73 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 75 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 76 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 77 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 78 | chmod ug+rw ${NGINX_CONF_PATH} && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 80 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 81 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 82 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 83 | rpm-file-permissions 84 | 85 | USER 1001 86 | 87 | STOPSIGNAL SIGQUIT 88 | 89 | CMD $STI_SCRIPTS_PATH/usage 90 | -------------------------------------------------------------------------------- /1.24/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM quay.io/fedora/s2i-core:38 2 | 3 | # nginx 1.24 image. 4 | # 5 | # Volumes: 6 | # * /var/log/nginx/ - Storage for logs 7 | 8 | EXPOSE 8080 9 | EXPOSE 8443 10 | 11 | ENV NAME=nginx \ 12 | NGINX_VERSION=1.24 \ 13 | NGINX_SHORT_VER=124 \ 14 | VERSION=0 \ 15 | ARCH=x86_64 16 | 17 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 18 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 19 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 20 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 21 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 22 | Nginx server image can be extended using source-to-image tool." 23 | 24 | LABEL summary="${SUMMARY}" \ 25 | description="${DESCRIPTION}" \ 26 | io.k8s.description="${DESCRIPTION}" \ 27 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 28 | io.openshift.expose-services="8080:http" \ 29 | io.openshift.expose-services="8443:https" \ 30 | io.openshift.tags="builder,${NAME},${NAME}${NGINX_SHORT_VER}" \ 31 | com.redhat.component="${NAME}" \ 32 | name="fedora/${NAME}-${NGINX_SHORT_VER}" \ 33 | version="${VERSION}" \ 34 | maintainer="SoftwareCollections.org " \ 35 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 36 | usage="s2i build ${FGC}/nginx " 37 | 38 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 39 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 40 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 41 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 42 | NGINX_APP_ROOT=${APP_ROOT} \ 43 | NGINX_LOG_PATH=/var/log/nginx \ 44 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 45 | 46 | RUN dnf install -y gettext hostname && \ 47 | INSTALL_PKGS="nss_wrapper-libs bind-utils nginx nginx-mod-stream nginx-mod-http-perl" && \ 48 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 49 | rpm -V $INSTALL_PKGS && \ 50 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 51 | dnf clean all 52 | 53 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 54 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 55 | 56 | # Copy extra files to the image. 57 | COPY $NGINX_VERSION/root/ / 58 | 59 | # Changing ownership and user rights to support following use-cases: 60 | # 1) running container on OpenShift, whose default security model 61 | # is to run the container under random UID, but GID=0 62 | # 2) for working root-less container with UID=1001, which does not have 63 | # to have GID=0 64 | # 3) for default use-case, that is running container directly on operating system, 65 | # with default UID and GID (1001:0) 66 | # Supported combinations of UID:GID are thus following: 67 | # UID=1001 && GID=0 68 | # UID=&& GID=0 69 | # UID=1001 && GID= 70 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 71 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 72 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 73 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 74 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 75 | mkdir -p ${NGINX_LOG_PATH} && \ 76 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 77 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 78 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 79 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 82 | chmod ug+rw ${NGINX_CONF_PATH} && \ 83 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 84 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 85 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 86 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 87 | rpm-file-permissions 88 | 89 | USER 1001 90 | 91 | STOPSIGNAL SIGQUIT 92 | 93 | CMD $STI_SCRIPTS_PATH/usage 94 | -------------------------------------------------------------------------------- /1.24/Dockerfile.rhel8: -------------------------------------------------------------------------------- 1 | FROM ubi8/s2i-core:1 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.24 \ 8 | NGINX_SHORT_VER=124 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="ubi8/${NAME}-${NGINX_SHORT_VER}" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build ubi8/${NAME}-${NGINX_SHORT_VER}:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 42 | INSTALL_PKGS="nss_wrapper-libs bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 43 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | yum -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY 1.24/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY 1.24/root/ / 53 | 54 | # Changing ownership and user rights to support following use-cases: 55 | # 1) running container on OpenShift, whose default security model 56 | # is to run the container under random UID, but GID=0 57 | # 2) for working root-less container with UID=1001, which does not have 58 | # to have GID=0 59 | # 3) for default use-case, that is running container directly on operating system, 60 | # with default UID and GID (1001:0) 61 | # Supported combinations of UID:GID are thus following: 62 | # UID=1001 && GID=0 63 | # UID=&& GID=0 64 | # UID=1001 && GID= 65 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 69 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 70 | mkdir -p ${NGINX_LOG_PATH} && \ 71 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 72 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 77 | chmod ug+rw ${NGINX_CONF_PATH} && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 82 | rpm-file-permissions 83 | 84 | USER 1001 85 | 86 | STOPSIGNAL SIGQUIT 87 | 88 | CMD $STI_SCRIPTS_PATH/usage 89 | -------------------------------------------------------------------------------- /1.24/Dockerfile.rhel9: -------------------------------------------------------------------------------- 1 | FROM ubi9/s2i-core:1 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.24 \ 8 | NGINX_SHORT_VER=124 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="ubi9/${NAME}-${NGINX_SHORT_VER}" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build ubi9/${NAME}-${NGINX_SHORT_VER}:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 42 | INSTALL_PKGS="nss_wrapper-libs bind9.18-utils gettext hostname nginx nginx-all-modules" && \ 43 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | yum -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY $NGINX_VERSION/root/ / 53 | 54 | # Changing ownership and user rights to support following use-cases: 55 | # 1) running container on OpenShift, whose default security model 56 | # is to run the container under random UID, but GID=0 57 | # 2) for working root-less container with UID=1001, which does not have 58 | # to have GID=0 59 | # 3) for default use-case, that is running container directly on operating system, 60 | # with default UID and GID (1001:0) 61 | # Supported combinations of UID:GID are thus following: 62 | # UID=1001 && GID=0 63 | # UID=&& GID=0 64 | # UID=1001 && GID= 65 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 69 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 70 | mkdir -p ${NGINX_LOG_PATH} && \ 71 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 72 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 77 | chmod ug+rw ${NGINX_CONF_PATH} && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 82 | rpm-file-permissions 83 | 84 | USER 1001 85 | 86 | STOPSIGNAL SIGQUIT 87 | 88 | CMD $STI_SCRIPTS_PATH/usage 89 | -------------------------------------------------------------------------------- /1.24/root/opt/app-root/etc/generate_container_user: -------------------------------------------------------------------------------- 1 | # Set current user in nss_wrapper 2 | PASSWD_DIR="/opt/app-root/etc" 3 | 4 | export USER_ID=$(id -u) 5 | export GROUP_ID=$(id -g) 6 | envsubst < ${PASSWD_DIR}/passwd.template > ${PASSWD_DIR}/passwd 7 | export LD_PRELOAD=libnss_wrapper.so 8 | export NSS_WRAPPER_PASSWD=${PASSWD_DIR}/passwd 9 | export NSS_WRAPPER_GROUP=/etc/group 10 | -------------------------------------------------------------------------------- /1.24/root/opt/app-root/etc/passwd.template: -------------------------------------------------------------------------------- 1 | root:x:0:0:root:/root:/bin/bash 2 | bin:x:1:1:bin:/bin:/sbin/nologin 3 | daemon:x:2:2:daemon:/sbin:/sbin/nologin 4 | adm:x:3:4:adm:/var/adm:/sbin/nologin 5 | lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin 6 | sync:x:5:0:sync:/sbin:/bin/sync 7 | shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown 8 | halt:x:7:0:halt:/sbin:/sbin/halt 9 | mail:x:8:12:mail:/var/spool/mail:/sbin/nologin 10 | operator:x:11:0:operator:/root:/sbin/nologin 11 | games:x:12:100:games:/usr/games:/sbin/nologin 12 | ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin 13 | nobody:x:99:99:Nobody:/:/sbin/nologin 14 | default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin 15 | apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin 16 | -------------------------------------------------------------------------------- /1.24/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # This will make scl collection binaries work out of box. 2 | unset BASH_ENV PROMPT_COMMAND ENV 3 | source scl_source enable rh-nginx$NGINX_SHORT_VER 4 | -------------------------------------------------------------------------------- /1.24/root/opt/app-root/nginxconf-rhscl.sed: -------------------------------------------------------------------------------- 1 | /listen/s%80%8080 default_server% 2 | s/^user *nginx;// 3 | s%/etc/nginx/conf.d/%/opt/app-root/etc/nginx.d/% 4 | s%/etc/nginx/default.d/%/opt/app-root/etc/nginx.default.d/% 5 | s%/usr/share/nginx/html%/opt/app-root/src% 6 | 7 | # See: https://github.com/sclorg/nginx-container/pull/69 8 | /error_page/d 9 | /40x.html/,+1d 10 | /50x.html/,+1d 11 | -------------------------------------------------------------------------------- /1.24/root/opt/app-root/nginxconf.sed: -------------------------------------------------------------------------------- 1 | /listen/s%80%8080 default_server% 2 | s/^user *nginx;// 3 | s%/etc/nginx/conf.d/%/opt/app-root/etc/nginx.d/% 4 | s%/etc/nginx/default.d/%/opt/app-root/etc/nginx.default.d/% 5 | s%/usr/share/nginx/html%/opt/app-root/src% 6 | 7 | # See: https://github.com/sclorg/nginx-container/pull/69 8 | /error_page/d 9 | /40x.html/,+1d 10 | /50x.html/,+1d 11 | -------------------------------------------------------------------------------- /1.24/root/usr/share/container-scripts/nginx/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # get_matched_files finds file for image extending 4 | function get_matched_files() { 5 | local custom_dir default_dir 6 | custom_dir="$1" 7 | default_dir="$2" 8 | files_matched="$3" 9 | find "$default_dir" -maxdepth 1 -type f -name "$files_matched" -printf "%f\n" 10 | [ -d "$custom_dir" ] && find "$custom_dir" -maxdepth 1 -type f -name "$files_matched" -printf "%f\n" 11 | } 12 | 13 | # process_extending_files process extending files in $1 and $2 directories 14 | # - source all *.sh files 15 | # (if there are files with same name source only file from $1) 16 | function process_extending_files() { 17 | local custom_dir default_dir 18 | custom_dir=$1 19 | default_dir=$2 20 | while read filename ; do 21 | if [ $filename ]; then 22 | echo "=> sourcing $filename ..." 23 | # Custom file is prefered 24 | if [ -f $custom_dir/$filename ]; then 25 | source $custom_dir/$filename 26 | elif [ -f $default_dir/$filename ]; then 27 | source $default_dir/$filename 28 | fi 29 | fi 30 | done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u)" 31 | } -------------------------------------------------------------------------------- /1.24/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "---> Installing application source" 6 | cp -Rf /tmp/src/. ./ 7 | 8 | # Fix source directory permissions 9 | fix-permissions ./ 10 | 11 | if [ -f ./nginx.conf ]; then 12 | echo "---> Copying nginx.conf configuration file..." 13 | cp -v ./nginx.conf "${NGINX_CONF_PATH}" 14 | rm -f ./nginx.conf 15 | fi 16 | 17 | if [ -d ./nginx-cfg ]; then 18 | echo "---> Copying nginx configuration files..." 19 | if [ "$(ls -A ./nginx-cfg/*.conf)" ]; then 20 | cp -av ./nginx-cfg/*.conf "${NGINX_CONFIGURATION_PATH}" 21 | rm -rf ./nginx-cfg 22 | fi 23 | chmod -Rf g+rw ${NGINX_CONFIGURATION_PATH} 24 | fi 25 | 26 | if [ -d ./nginx-default-cfg ]; then 27 | echo "---> Copying nginx default server configuration files..." 28 | if [ "$(ls -A ./nginx-default-cfg/*.conf)" ]; then 29 | cp -av ./nginx-default-cfg/*.conf "${NGINX_DEFAULT_CONF_PATH}" 30 | rm -rf ./nginx-default-cfg 31 | fi 32 | chmod -Rf g+rw ${NGINX_DEFAULT_CONF_PATH} 33 | fi 34 | 35 | if [ -d ./nginx-start ]; then 36 | echo "---> Copying nginx start-hook scripts..." 37 | if [ "$(ls -A ./nginx-start/* 2>/dev/null)" ]; then 38 | cp -av ./nginx-start/* "${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start/" 39 | rm -rf ./nginx-start 40 | fi 41 | fi 42 | 43 | if [ -n "${NGINX_PERL_MODULE_PATH}" ] && [ -d ./nginx-perl ]; then 44 | echo "---> Copying nginx perl module files..." 45 | if [ "$(ls -A ./nginx-perl/*.pm)" ]; then 46 | cp -av ./nginx-perl/*.pm "${NGINX_PERL_MODULE_PATH}" 47 | rm -rf ./nginx-perl 48 | fi 49 | chmod -Rf g+rw ${NGINX_PERL_MODULE_PATH} 50 | fi 51 | -------------------------------------------------------------------------------- /1.24/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source /opt/app-root/etc/generate_container_user 4 | 5 | set -e 6 | 7 | source ${NGINX_CONTAINER_SCRIPTS_PATH}/common.sh 8 | 9 | process_extending_files ${NGINX_APP_ROOT}/src/nginx-start ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start 10 | 11 | if [ ! -v NGINX_LOG_TO_VOLUME -a -v NGINX_LOG_PATH ]; then 12 | /bin/ln -sf /dev/stdout ${NGINX_LOG_PATH}/access.log 13 | /bin/ln -sf /dev/stderr ${NGINX_LOG_PATH}/error.log 14 | fi 15 | 16 | exec nginx -g "daemon off;" 17 | -------------------------------------------------------------------------------- /1.24/s2i/bin/usage: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` 4 | 5 | cat < 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.24/test/perl-test-app/nginx-perl/Version.pm: -------------------------------------------------------------------------------- 1 | package Version; 2 | 3 | use nginx; 4 | 5 | sub installed { 6 | return "$^V"; 7 | } 8 | 9 | sub handler { 10 | my $r = shift; 11 | $r->send_http_header("text/html"); 12 | $r->print("Perl location handler is working"); 13 | return OK; 14 | } 15 | 16 | 1; 17 | __END__ 18 | -------------------------------------------------------------------------------- /1.24/test/perl-test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | perl_modules /opt/app-root/etc/perl; 19 | perl_require Version.pm; 20 | 21 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 22 | '$status $body_bytes_sent "$http_referer" ' 23 | '"$http_user_agent" "$http_x_forwarded_for"'; 24 | 25 | 26 | sendfile on; 27 | tcp_nopush on; 28 | tcp_nodelay on; 29 | keepalive_timeout 65; 30 | types_hash_max_size 2048; 31 | 32 | include /etc/nginx/mime.types; 33 | default_type application/octet-stream; 34 | 35 | perl_set $perl_version Version::installed; 36 | add_header X-Perl-Version $perl_version; 37 | 38 | # Load modular configuration files from the /etc/nginx/conf.d directory. 39 | # See http://nginx.org/en/docs/ngx_core_module.html#include 40 | # for more information. 41 | include /opt/app-root/etc/nginx.d/*.conf; 42 | 43 | server { 44 | listen 8080 default_server; 45 | listen [::]:8080 default_server; 46 | server_name _; 47 | root /opt/app-root/src; 48 | 49 | # Load configuration files for the default server block. 50 | include /opt/app-root/etc/nginx.default.d/*.conf; 51 | 52 | location / { 53 | } 54 | 55 | location /perl { 56 | perl Version::handler; 57 | } 58 | 59 | error_page 404 /404.html; 60 | location = /40x.html { 61 | } 62 | 63 | error_page 500 502 503 504 /50x.html; 64 | location = /50x.html { 65 | } 66 | } 67 | 68 | # Settings for a TLS enabled server. 69 | # 70 | # server { 71 | # listen 443 ssl http2 default_server; 72 | # listen [::]:443 ssl http2 default_server; 73 | # server_name _; 74 | # root /opt/app-root/src; 75 | # 76 | # ssl_certificate "/etc/pki/nginx/server.crt"; 77 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 78 | # ssl_session_cache shared:SSL:1m; 79 | # ssl_session_timeout 10m; 80 | # ssl_ciphers PROFILE=SYSTEM; 81 | # ssl_prefer_server_ciphers on; 82 | # 83 | # # Load configuration files for the default server block. 84 | # include /opt/app-root/etc/nginx.default.d/*.conf; 85 | # 86 | # location / { 87 | # } 88 | # 89 | # error_page 404 /404.html; 90 | # location = /40x.html { 91 | # } 92 | # 93 | # error_page 500 502 503 504 /50x.html; 94 | # location = /50x.html { 95 | # } 96 | # } 97 | 98 | } 99 | 100 | -------------------------------------------------------------------------------- /1.24/test/run: -------------------------------------------------------------------------------- 1 | ../../test/run -------------------------------------------------------------------------------- /1.24/test/run-openshift-pytest: -------------------------------------------------------------------------------- 1 | ../../test/run-openshift-pytest -------------------------------------------------------------------------------- /1.24/test/run-openshift-remote-cluster: -------------------------------------------------------------------------------- 1 | ../../test/run-openshift-remote-cluster -------------------------------------------------------------------------------- /1.24/test/start-hook-test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.24/test/start-hook-test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.24/test/start-hook-test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index ${INDEX_FILE}; 6 | resolver ${DNS_SERVER}; 7 | 8 | } -------------------------------------------------------------------------------- /1.24/test/start-hook-test-app/nginx-start/init.sh: -------------------------------------------------------------------------------- 1 | setup_dns_env_var() { 2 | if [ -z "$DNS_SERVER" ]; then 3 | export DNS_SERVER=`cat /etc/resolv.conf | grep "nameserver " | awk '{print $2}' | tr '\n' ' '` 4 | echo "Using system dns server ${DNS_SERVER}" 5 | else 6 | echo "Using user defined dns server: ${DNS_SERVER}" 7 | fi 8 | } 9 | 10 | inject_env_vars() { 11 | ## Replace only specified environment variables in specified file. 12 | envsubst '${DNS_SERVER},${INDEX_FILE}' < ${NGINX_CONFIGURATION_PATH}/$1 > output.conf 13 | cp output.conf ${NGINX_CONFIGURATION_PATH}/$1 14 | echo "This is $1: " && cat ${NGINX_CONFIGURATION_PATH}/$1 15 | } 16 | 17 | export INDEX_FILE=index2.html 18 | setup_dns_env_var 19 | inject_env_vars "default.conf" 20 | -------------------------------------------------------------------------------- /1.24/test/test-app: -------------------------------------------------------------------------------- 1 | ../../examples/1.24/test-app -------------------------------------------------------------------------------- /1.24/test/test-lib-nginx.sh: -------------------------------------------------------------------------------- 1 | ../../test/test-lib-nginx.sh -------------------------------------------------------------------------------- /1.24/test/test-lib-openshift.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib-openshift.sh -------------------------------------------------------------------------------- /1.24/test/test-lib-remote-openshift.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib-remote-openshift.sh -------------------------------------------------------------------------------- /1.24/test/test-lib.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib.sh -------------------------------------------------------------------------------- /1.24/test/test-openshift.yaml: -------------------------------------------------------------------------------- 1 | ../../common/test-openshift.yaml -------------------------------------------------------------------------------- /1.24/test/test_nginx_imagestream_s2i.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_imagestream_s2i.py -------------------------------------------------------------------------------- /1.24/test/test_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_imagestreams.py -------------------------------------------------------------------------------- /1.24/test/test_nginx_local_example.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_local_example.py -------------------------------------------------------------------------------- /1.24/test/test_nginx_remote_example.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_remote_example.py -------------------------------------------------------------------------------- /1.24/test/test_nginx_template_example_app.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_template_example_app.py -------------------------------------------------------------------------------- /1.24/test/test_shared_helm_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../../test/test_shared_helm_nginx_imagestreams.py -------------------------------------------------------------------------------- /1.24/test/test_shared_helm_nginx_template.py: -------------------------------------------------------------------------------- 1 | ../../test/test_shared_helm_nginx_template.py -------------------------------------------------------------------------------- /1.26/.exclude-rhel8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sclorg/nginx-container/d155f6e1e36cee35c86cd3f0e90e313bf5a6d7bf/1.26/.exclude-rhel8 -------------------------------------------------------------------------------- /1.26/Dockerfile.c10s: -------------------------------------------------------------------------------- 1 | FROM quay.io/sclorg/s2i-core-c10s:c10s 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.26 \ 8 | NGINX_SHORT_VER=126 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="sclorg/${NAME}-${NGINX_SHORT_VER}-c10s" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build quay.io/sclorg/${NAME}-${NGINX_SHORT_VER}-c10s:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | # Modules does not exist 42 | RUN INSTALL_PKGS="nss_wrapper-libs bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 43 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | dnf -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY $NGINX_VERSION/root/ / 53 | 54 | # Changing ownership and user rights to support following use-cases: 55 | # 1) running container on OpenShift, whose default security model 56 | # is to run the container under random UID, but GID=0 57 | # 2) for working root-less container with UID=1001, which does not have 58 | # to have GID=0 59 | # 3) for default use-case, that is running container directly on operating system, 60 | # with default UID and GID (1001:0) 61 | # Supported combinations of UID:GID are thus following: 62 | # UID=1001 && GID=0 63 | # UID=&& GID=0 64 | # UID=1001 && GID= 65 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 69 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 70 | mkdir -p ${NGINX_LOG_PATH} && \ 71 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 72 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 77 | chmod ug+rw ${NGINX_CONF_PATH} && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 82 | rpm-file-permissions 83 | 84 | USER 1001 85 | 86 | STOPSIGNAL SIGQUIT 87 | 88 | CMD $STI_SCRIPTS_PATH/usage 89 | -------------------------------------------------------------------------------- /1.26/Dockerfile.c9s: -------------------------------------------------------------------------------- 1 | FROM quay.io/sclorg/s2i-core-c9s:c9s 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.26 \ 8 | NGINX_SHORT_VER=126 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="sclorg/${NAME}-${NGINX_SHORT_VER}-c9s" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build quay.io/sclorg/${NAME}-${NGINX_SHORT_VER}-c9s:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | # Modules does not exist 42 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 43 | INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-all-modules" && \ 44 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 45 | rpm -V $INSTALL_PKGS && \ 46 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 47 | yum -y clean all --enablerepo='*' 48 | 49 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 50 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 51 | 52 | # Copy extra files to the image. 53 | COPY $NGINX_VERSION/root/ / 54 | 55 | # Changing ownership and user rights to support following use-cases: 56 | # 1) running container on OpenShift, whose default security model 57 | # is to run the container under random UID, but GID=0 58 | # 2) for working root-less container with UID=1001, which does not have 59 | # to have GID=0 60 | # 3) for default use-case, that is running container directly on operating system, 61 | # with default UID and GID (1001:0) 62 | # Supported combinations of UID:GID are thus following: 63 | # UID=1001 && GID=0 64 | # UID=&& GID=0 65 | # UID=1001 && GID= 66 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 69 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 70 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 71 | mkdir -p ${NGINX_LOG_PATH} && \ 72 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 73 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 75 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 76 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 77 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 78 | chmod ug+rw ${NGINX_CONF_PATH} && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 80 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 81 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 82 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 83 | rpm-file-permissions 84 | 85 | USER 1001 86 | 87 | STOPSIGNAL SIGQUIT 88 | 89 | CMD $STI_SCRIPTS_PATH/usage 90 | -------------------------------------------------------------------------------- /1.26/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM quay.io/fedora/s2i-core:40 2 | 3 | 4 | EXPOSE 8080 5 | EXPOSE 8443 6 | 7 | ENV NAME=nginx \ 8 | NGINX_VERSION=1.26 \ 9 | NGINX_SHORT_VER=126 \ 10 | VERSION=0 \ 11 | ARCH=x86_64 12 | 13 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 14 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 15 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 16 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 17 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 18 | Nginx server image can be extended using source-to-image tool." 19 | 20 | LABEL summary="${SUMMARY}" \ 21 | description="${DESCRIPTION}" \ 22 | io.k8s.description="${DESCRIPTION}" \ 23 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 24 | io.openshift.expose-services="8080:http" \ 25 | io.openshift.expose-services="8443:https" \ 26 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 27 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}" \ 28 | name="fedora/${NAME}-${NGINX_SHORT_VER}" \ 29 | version="${VERSION}" \ 30 | maintainer="SoftwareCollections.org " \ 31 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 32 | usage="s2i build ${FGC}/nginx " 33 | 34 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 35 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 36 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 37 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 38 | NGINX_APP_ROOT=${APP_ROOT} \ 39 | NGINX_LOG_PATH=/var/log/nginx \ 40 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 41 | 42 | RUN dnf install -y gettext hostname && \ 43 | INSTALL_PKGS="nss_wrapper-libs bind-utils nginx nginx-mod-stream nginx-mod-http-perl" && \ 44 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 45 | rpm -V $INSTALL_PKGS && \ 46 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 47 | dnf clean all 48 | 49 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 50 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 51 | 52 | # Copy extra files to the image. 53 | COPY $NGINX_VERSION/root/ / 54 | 55 | # Changing ownership and user rights to support following use-cases: 56 | # 1) running container on OpenShift, whose default security model 57 | # is to run the container under random UID, but GID=0 58 | # 2) for working root-less container with UID=1001, which does not have 59 | # to have GID=0 60 | # 3) for default use-case, that is running container directly on operating system, 61 | # with default UID and GID (1001:0) 62 | # Supported combinations of UID:GID are thus following: 63 | # UID=1001 && GID=0 64 | # UID=&& GID=0 65 | # UID=1001 && GID= 66 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 69 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 70 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 71 | mkdir -p ${NGINX_LOG_PATH} && \ 72 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 73 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 75 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 76 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 77 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 78 | chmod ug+rw ${NGINX_CONF_PATH} && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 80 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 81 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 82 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 83 | rpm-file-permissions 84 | 85 | USER 1001 86 | 87 | STOPSIGNAL SIGQUIT 88 | 89 | CMD $STI_SCRIPTS_PATH/usage 90 | -------------------------------------------------------------------------------- /1.26/Dockerfile.rhel10: -------------------------------------------------------------------------------- 1 | FROM ubi10/s2i-core 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.26 \ 8 | NGINX_SHORT_VER=126 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="ubi10/nginx-${NGINX_SHORT_VER}" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build ubi10/nginx-${NGINX_SHORT_VER} " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | # Modules does not exist 42 | RUN INSTALL_PKGS="nss_wrapper-libs bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 43 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | dnf -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY $NGINX_VERSION/root/ / 53 | 54 | # Changing ownership and user rights to support following use-cases: 55 | # 1) running container on OpenShift, whose default security model 56 | # is to run the container under random UID, but GID=0 57 | # 2) for working root-less container with UID=1001, which does not have 58 | # to have GID=0 59 | # 3) for default use-case, that is running container directly on operating system, 60 | # with default UID and GID (1001:0) 61 | # Supported combinations of UID:GID are thus following: 62 | # UID=1001 && GID=0 63 | # UID=&& GID=0 64 | # UID=1001 && GID= 65 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 69 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 70 | mkdir -p ${NGINX_LOG_PATH} && \ 71 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 72 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 77 | chmod ug+rw ${NGINX_CONF_PATH} && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 82 | rpm-file-permissions 83 | 84 | USER 1001 85 | 86 | STOPSIGNAL SIGQUIT 87 | 88 | CMD $STI_SCRIPTS_PATH/usage 89 | -------------------------------------------------------------------------------- /1.26/Dockerfile.rhel8: -------------------------------------------------------------------------------- 1 | FROM ubi8/s2i-core:1 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.26 \ 8 | NGINX_SHORT_VER=126 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="ubi8/${NAME}-${NGINX_SHORT_VER}" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build ubi8/${NAME}-${NGINX_SHORT_VER}:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 42 | INSTALL_PKGS="nss_wrapper-libs bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl" && \ 43 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | yum -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY 1.24/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY 1.24/root/ / 53 | 54 | # Changing ownership and user rights to support following use-cases: 55 | # 1) running container on OpenShift, whose default security model 56 | # is to run the container under random UID, but GID=0 57 | # 2) for working root-less container with UID=1001, which does not have 58 | # to have GID=0 59 | # 3) for default use-case, that is running container directly on operating system, 60 | # with default UID and GID (1001:0) 61 | # Supported combinations of UID:GID are thus following: 62 | # UID=1001 && GID=0 63 | # UID=&& GID=0 64 | # UID=1001 && GID= 65 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 69 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 70 | mkdir -p ${NGINX_LOG_PATH} && \ 71 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 72 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 77 | chmod ug+rw ${NGINX_CONF_PATH} && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 82 | rpm-file-permissions 83 | 84 | USER 1001 85 | 86 | STOPSIGNAL SIGQUIT 87 | 88 | CMD $STI_SCRIPTS_PATH/usage 89 | -------------------------------------------------------------------------------- /1.26/Dockerfile.rhel9: -------------------------------------------------------------------------------- 1 | FROM ubi9/s2i-core:1 2 | 3 | EXPOSE 8080 4 | EXPOSE 8443 5 | 6 | ENV NAME=nginx \ 7 | NGINX_VERSION=1.26 \ 8 | NGINX_SHORT_VER=126 \ 9 | VERSION=0 10 | 11 | ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ 12 | DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ 13 | protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ 14 | image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ 15 | as a base image for other applications based on nginx $NGINX_VERSION web server. \ 16 | Nginx server image can be extended using source-to-image tool." 17 | 18 | LABEL summary="${SUMMARY}" \ 19 | description="${DESCRIPTION}" \ 20 | io.k8s.description="${DESCRIPTION}" \ 21 | io.k8s.display-name="Nginx ${NGINX_VERSION}" \ 22 | io.openshift.expose-services="8080:http" \ 23 | io.openshift.expose-services="8443:https" \ 24 | io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ 25 | com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ 26 | name="ubi9/${NAME}-${NGINX_SHORT_VER}" \ 27 | version="1" \ 28 | com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ 29 | maintainer="SoftwareCollections.org " \ 30 | help="For more information visit https://github.com/sclorg/${NAME}-container" \ 31 | usage="s2i build ubi9/${NAME}-${NGINX_SHORT_VER}:latest " 32 | 33 | ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ 34 | NGINX_CONF_PATH=/etc/nginx/nginx.conf \ 35 | NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ 36 | NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ 37 | NGINX_APP_ROOT=${APP_ROOT} \ 38 | NGINX_LOG_PATH=/var/log/nginx \ 39 | NGINX_PERL_MODULE_PATH=${APP_ROOT}/etc/perl 40 | 41 | RUN yum -y module enable nginx:$NGINX_VERSION && \ 42 | INSTALL_PKGS="nss_wrapper-libs bind9.18-utils gettext hostname nginx nginx-all-modules" && \ 43 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 44 | rpm -V $INSTALL_PKGS && \ 45 | nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \ 46 | yum -y clean all --enablerepo='*' 47 | 48 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH 49 | COPY $NGINX_VERSION/s2i/bin/ $STI_SCRIPTS_PATH 50 | 51 | # Copy extra files to the image. 52 | COPY $NGINX_VERSION/root/ / 53 | 54 | # Changing ownership and user rights to support following use-cases: 55 | # 1) running container on OpenShift, whose default security model 56 | # is to run the container under random UID, but GID=0 57 | # 2) for working root-less container with UID=1001, which does not have 58 | # to have GID=0 59 | # 3) for default use-case, that is running container directly on operating system, 60 | # with default UID and GID (1001:0) 61 | # Supported combinations of UID:GID are thus following: 62 | # UID=1001 && GID=0 63 | # UID=&& GID=0 64 | # UID=1001 && GID= 65 | RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \ 66 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && \ 67 | mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && \ 68 | mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && \ 69 | mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 70 | mkdir -p ${NGINX_LOG_PATH} && \ 71 | mkdir -p ${NGINX_PERL_MODULE_PATH} && \ 72 | chown -R 1001:0 ${NGINX_CONF_PATH} && \ 73 | chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \ 74 | chown -R 1001:0 ${NGINX_APP_ROOT}/src/nginx-start/ && \ 75 | chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 76 | chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \ 77 | chmod ug+rw ${NGINX_CONF_PATH} && \ 78 | chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \ 79 | chmod -R ug+rwX ${NGINX_APP_ROOT}/src/nginx-start/ && \ 80 | chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \ 81 | chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \ 82 | rpm-file-permissions 83 | 84 | USER 1001 85 | 86 | STOPSIGNAL SIGQUIT 87 | 88 | CMD $STI_SCRIPTS_PATH/usage 89 | -------------------------------------------------------------------------------- /1.26/root/opt/app-root/etc/generate_container_user: -------------------------------------------------------------------------------- 1 | # Set current user in nss_wrapper 2 | PASSWD_DIR="/opt/app-root/etc" 3 | 4 | export USER_ID=$(id -u) 5 | export GROUP_ID=$(id -g) 6 | envsubst < ${PASSWD_DIR}/passwd.template > ${PASSWD_DIR}/passwd 7 | export LD_PRELOAD=libnss_wrapper.so 8 | export NSS_WRAPPER_PASSWD=${PASSWD_DIR}/passwd 9 | export NSS_WRAPPER_GROUP=/etc/group 10 | -------------------------------------------------------------------------------- /1.26/root/opt/app-root/etc/passwd.template: -------------------------------------------------------------------------------- 1 | root:x:0:0:root:/root:/bin/bash 2 | bin:x:1:1:bin:/bin:/sbin/nologin 3 | daemon:x:2:2:daemon:/sbin:/sbin/nologin 4 | adm:x:3:4:adm:/var/adm:/sbin/nologin 5 | lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin 6 | sync:x:5:0:sync:/sbin:/bin/sync 7 | shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown 8 | halt:x:7:0:halt:/sbin:/sbin/halt 9 | mail:x:8:12:mail:/var/spool/mail:/sbin/nologin 10 | operator:x:11:0:operator:/root:/sbin/nologin 11 | games:x:12:100:games:/usr/games:/sbin/nologin 12 | ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin 13 | nobody:x:99:99:Nobody:/:/sbin/nologin 14 | default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin 15 | apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin 16 | -------------------------------------------------------------------------------- /1.26/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # This will make scl collection binaries work out of box. 2 | unset BASH_ENV PROMPT_COMMAND ENV 3 | source scl_source enable rh-nginx$NGINX_SHORT_VER 4 | -------------------------------------------------------------------------------- /1.26/root/opt/app-root/nginxconf-rhscl.sed: -------------------------------------------------------------------------------- 1 | /listen/s%80%8080 default_server% 2 | s/^user *nginx;// 3 | s%/etc/nginx/conf.d/%/opt/app-root/etc/nginx.d/% 4 | s%/etc/nginx/default.d/%/opt/app-root/etc/nginx.default.d/% 5 | s%/usr/share/nginx/html%/opt/app-root/src% 6 | 7 | # See: https://github.com/sclorg/nginx-container/pull/69 8 | /error_page/d 9 | /40x.html/,+1d 10 | /50x.html/,+1d 11 | -------------------------------------------------------------------------------- /1.26/root/opt/app-root/nginxconf.sed: -------------------------------------------------------------------------------- 1 | /listen/s%80%8080 default_server% 2 | s/^user *nginx;// 3 | s%/etc/nginx/conf.d/%/opt/app-root/etc/nginx.d/% 4 | s%/etc/nginx/default.d/%/opt/app-root/etc/nginx.default.d/% 5 | s%/usr/share/nginx/html%/opt/app-root/src% 6 | 7 | # See: https://github.com/sclorg/nginx-container/pull/69 8 | /error_page/d 9 | /40x.html/,+1d 10 | /50x.html/,+1d 11 | -------------------------------------------------------------------------------- /1.26/root/usr/share/container-scripts/nginx/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # get_matched_files finds file for image extending 4 | function get_matched_files() { 5 | local custom_dir default_dir 6 | custom_dir="$1" 7 | default_dir="$2" 8 | files_matched="$3" 9 | find "$default_dir" -maxdepth 1 -type f -name "$files_matched" -printf "%f\n" 10 | [ -d "$custom_dir" ] && find "$custom_dir" -maxdepth 1 -type f -name "$files_matched" -printf "%f\n" 11 | } 12 | 13 | # process_extending_files process extending files in $1 and $2 directories 14 | # - source all *.sh files 15 | # (if there are files with same name source only file from $1) 16 | function process_extending_files() { 17 | local custom_dir default_dir 18 | custom_dir=$1 19 | default_dir=$2 20 | while read filename ; do 21 | if [ $filename ]; then 22 | echo "=> sourcing $filename ..." 23 | # Custom file is prefered 24 | if [ -f $custom_dir/$filename ]; then 25 | source $custom_dir/$filename 26 | elif [ -f $default_dir/$filename ]; then 27 | source $default_dir/$filename 28 | fi 29 | fi 30 | done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.sh' | sort -u)" 31 | } -------------------------------------------------------------------------------- /1.26/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "---> Installing application source" 6 | cp -Rf /tmp/src/. ./ 7 | 8 | # Fix source directory permissions 9 | fix-permissions ./ 10 | 11 | if [ -f ./nginx.conf ]; then 12 | echo "---> Copying nginx.conf configuration file..." 13 | cp -v ./nginx.conf "${NGINX_CONF_PATH}" 14 | rm -f ./nginx.conf 15 | fi 16 | 17 | if [ -d ./nginx-cfg ]; then 18 | echo "---> Copying nginx configuration files..." 19 | if [ "$(ls -A ./nginx-cfg/*.conf)" ]; then 20 | cp -av ./nginx-cfg/*.conf "${NGINX_CONFIGURATION_PATH}" 21 | rm -rf ./nginx-cfg 22 | fi 23 | chmod -Rf g+rw ${NGINX_CONFIGURATION_PATH} 24 | fi 25 | 26 | if [ -d ./nginx-default-cfg ]; then 27 | echo "---> Copying nginx default server configuration files..." 28 | if [ "$(ls -A ./nginx-default-cfg/*.conf)" ]; then 29 | cp -av ./nginx-default-cfg/*.conf "${NGINX_DEFAULT_CONF_PATH}" 30 | rm -rf ./nginx-default-cfg 31 | fi 32 | chmod -Rf g+rw ${NGINX_DEFAULT_CONF_PATH} 33 | fi 34 | 35 | if [ -d ./nginx-start ]; then 36 | echo "---> Copying nginx start-hook scripts..." 37 | if [ "$(ls -A ./nginx-start/* 2>/dev/null)" ]; then 38 | cp -av ./nginx-start/* "${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start/" 39 | rm -rf ./nginx-start 40 | fi 41 | fi 42 | 43 | if [ -n "${NGINX_PERL_MODULE_PATH}" ] && [ -d ./nginx-perl ]; then 44 | echo "---> Copying nginx perl module files..." 45 | if [ "$(ls -A ./nginx-perl/*.pm)" ]; then 46 | cp -av ./nginx-perl/*.pm "${NGINX_PERL_MODULE_PATH}" 47 | rm -rf ./nginx-perl 48 | fi 49 | chmod -Rf g+rw ${NGINX_PERL_MODULE_PATH} 50 | fi 51 | -------------------------------------------------------------------------------- /1.26/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source /opt/app-root/etc/generate_container_user 4 | 5 | set -e 6 | 7 | source ${NGINX_CONTAINER_SCRIPTS_PATH}/common.sh 8 | 9 | process_extending_files ${NGINX_APP_ROOT}/src/nginx-start ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start 10 | 11 | if [ ! -v NGINX_LOG_TO_VOLUME -a -v NGINX_LOG_PATH ]; then 12 | /bin/ln -sf /dev/stdout ${NGINX_LOG_PATH}/access.log 13 | /bin/ln -sf /dev/stderr ${NGINX_LOG_PATH}/error.log 14 | fi 15 | 16 | exec nginx -g "daemon off;" 17 | -------------------------------------------------------------------------------- /1.26/s2i/bin/usage: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` 4 | 5 | cat < 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.26/test/perl-test-app/nginx-perl/Version.pm: -------------------------------------------------------------------------------- 1 | package Version; 2 | 3 | use nginx; 4 | 5 | sub installed { 6 | return "$^V"; 7 | } 8 | 9 | sub handler { 10 | my $r = shift; 11 | $r->send_http_header("text/html"); 12 | $r->print("Perl location handler is working"); 13 | return OK; 14 | } 15 | 16 | 1; 17 | __END__ 18 | -------------------------------------------------------------------------------- /1.26/test/perl-test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | perl_modules /opt/app-root/etc/perl; 19 | perl_require Version.pm; 20 | 21 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 22 | '$status $body_bytes_sent "$http_referer" ' 23 | '"$http_user_agent" "$http_x_forwarded_for"'; 24 | 25 | 26 | sendfile on; 27 | tcp_nopush on; 28 | tcp_nodelay on; 29 | keepalive_timeout 65; 30 | types_hash_max_size 2048; 31 | 32 | include /etc/nginx/mime.types; 33 | default_type application/octet-stream; 34 | 35 | perl_set $perl_version Version::installed; 36 | add_header X-Perl-Version $perl_version; 37 | 38 | # Load modular configuration files from the /etc/nginx/conf.d directory. 39 | # See http://nginx.org/en/docs/ngx_core_module.html#include 40 | # for more information. 41 | include /opt/app-root/etc/nginx.d/*.conf; 42 | 43 | server { 44 | listen 8080 default_server; 45 | listen [::]:8080 default_server; 46 | server_name _; 47 | root /opt/app-root/src; 48 | 49 | # Load configuration files for the default server block. 50 | include /opt/app-root/etc/nginx.default.d/*.conf; 51 | 52 | location / { 53 | } 54 | 55 | location /perl { 56 | perl Version::handler; 57 | } 58 | 59 | error_page 404 /404.html; 60 | location = /40x.html { 61 | } 62 | 63 | error_page 500 502 503 504 /50x.html; 64 | location = /50x.html { 65 | } 66 | } 67 | 68 | # Settings for a TLS enabled server. 69 | # 70 | # server { 71 | # listen 443 ssl http2 default_server; 72 | # listen [::]:443 ssl http2 default_server; 73 | # server_name _; 74 | # root /opt/app-root/src; 75 | # 76 | # ssl_certificate "/etc/pki/nginx/server.crt"; 77 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 78 | # ssl_session_cache shared:SSL:1m; 79 | # ssl_session_timeout 10m; 80 | # ssl_ciphers PROFILE=SYSTEM; 81 | # ssl_prefer_server_ciphers on; 82 | # 83 | # # Load configuration files for the default server block. 84 | # include /opt/app-root/etc/nginx.default.d/*.conf; 85 | # 86 | # location / { 87 | # } 88 | # 89 | # error_page 404 /404.html; 90 | # location = /40x.html { 91 | # } 92 | # 93 | # error_page 500 502 503 504 /50x.html; 94 | # location = /50x.html { 95 | # } 96 | # } 97 | 98 | } 99 | 100 | -------------------------------------------------------------------------------- /1.26/test/run: -------------------------------------------------------------------------------- 1 | ../../test/run -------------------------------------------------------------------------------- /1.26/test/run-openshift-remote-cluster: -------------------------------------------------------------------------------- 1 | ../../test/run-openshift-remote-cluster -------------------------------------------------------------------------------- /1.26/test/start-hook-test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.26/test/start-hook-test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /1.26/test/start-hook-test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index ${INDEX_FILE}; 6 | resolver ${DNS_SERVER}; 7 | 8 | } -------------------------------------------------------------------------------- /1.26/test/start-hook-test-app/nginx-start/init.sh: -------------------------------------------------------------------------------- 1 | setup_dns_env_var() { 2 | if [ -z "$DNS_SERVER" ]; then 3 | export DNS_SERVER=`cat /etc/resolv.conf | grep "nameserver " | awk '{print $2}' | tr '\n' ' '` 4 | echo "Using system dns server ${DNS_SERVER}" 5 | else 6 | echo "Using user defined dns server: ${DNS_SERVER}" 7 | fi 8 | } 9 | 10 | inject_env_vars() { 11 | ## Replace only specified environment variables in specified file. 12 | envsubst '${DNS_SERVER},${INDEX_FILE}' < ${NGINX_CONFIGURATION_PATH}/$1 > output.conf 13 | cp output.conf ${NGINX_CONFIGURATION_PATH}/$1 14 | echo "This is $1: " && cat ${NGINX_CONFIGURATION_PATH}/$1 15 | } 16 | 17 | export INDEX_FILE=index2.html 18 | setup_dns_env_var 19 | inject_env_vars "default.conf" 20 | -------------------------------------------------------------------------------- /1.26/test/test-app: -------------------------------------------------------------------------------- 1 | ../../examples/1.26/test-app -------------------------------------------------------------------------------- /1.26/test/test-lib-nginx.sh: -------------------------------------------------------------------------------- 1 | ../../test/test-lib-nginx.sh -------------------------------------------------------------------------------- /1.26/test/test-lib-openshift.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib-openshift.sh -------------------------------------------------------------------------------- /1.26/test/test-lib-remote-openshift.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib-remote-openshift.sh -------------------------------------------------------------------------------- /1.26/test/test-lib.sh: -------------------------------------------------------------------------------- 1 | ../../common/test-lib.sh -------------------------------------------------------------------------------- /1.26/test/test-openshift.yaml: -------------------------------------------------------------------------------- 1 | ../../common/test-openshift.yaml -------------------------------------------------------------------------------- /1.26/test/test_nginx_imagestream_s2i.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_imagestream_s2i.py -------------------------------------------------------------------------------- /1.26/test/test_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_imagestreams.py -------------------------------------------------------------------------------- /1.26/test/test_nginx_local_example.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_local_example.py -------------------------------------------------------------------------------- /1.26/test/test_nginx_remote_example.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_remote_example.py -------------------------------------------------------------------------------- /1.26/test/test_nginx_template_example_app.py: -------------------------------------------------------------------------------- 1 | ../../test/test_nginx_template_example_app.py -------------------------------------------------------------------------------- /1.26/test/test_shared_helm_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../../test/test_shared_helm_nginx_imagestreams.py -------------------------------------------------------------------------------- /1.26/test/test_shared_helm_nginx_template.py: -------------------------------------------------------------------------------- 1 | ../../test/test_shared_helm_nginx_template.py -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Variables are documented in common/build.sh. 2 | BASE_IMAGE_NAME = nginx 3 | VERSIONS = 1.20 1.22 1.22-micro 1.24 1.26 4 | OPENSHIFT_NAMESPACES = 5 | DOCKER_BUILD_CONTEXT = .. 6 | 7 | # HACK: Ensure that 'git pull' for old clones doesn't cause confusion. 8 | # New clones should use '--recursive'. 9 | .PHONY: $(shell test -f common/common.mk || echo >&2 'Please do "git submodule update --init" first.') 10 | 11 | include common/common.mk 12 | -------------------------------------------------------------------------------- /core-scripts: -------------------------------------------------------------------------------- 1 | common/shared-scripts/core/ -------------------------------------------------------------------------------- /examples/1.10/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.10/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.10/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.10/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/1.12/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.12/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.12/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.12/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/1.12/test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | # perl_modules /opt/app-root/etc/perl; 19 | # perl_require Version.pm; 20 | # perl_set $perl_version Version::installed; 21 | 22 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 23 | '$status $body_bytes_sent "$http_referer" ' 24 | '"$http_user_agent" "$http_x_forwarded_for"'; 25 | 26 | 27 | sendfile on; 28 | tcp_nopush on; 29 | tcp_nodelay on; 30 | keepalive_timeout 65; 31 | types_hash_max_size 2048; 32 | 33 | include /etc/nginx/mime.types; 34 | default_type application/octet-stream; 35 | 36 | # Load modular configuration files from the /etc/nginx/conf.d directory. 37 | # See http://nginx.org/en/docs/ngx_core_module.html#include 38 | # for more information. 39 | include /opt/app-root/etc/nginx.d/*.conf; 40 | 41 | server { 42 | listen 8080 default_server; 43 | listen [::]:8080 default_server; 44 | server_name _; 45 | root /opt/app-root/src; 46 | 47 | # Load configuration files for the default server block. 48 | include /opt/app-root/etc/nginx.default.d/*.conf; 49 | 50 | location / { 51 | } 52 | 53 | error_page 404 /404.html; 54 | location = /40x.html { 55 | } 56 | 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | } 60 | } 61 | 62 | # Settings for a TLS enabled server. 63 | # 64 | # server { 65 | # listen 443 ssl http2 default_server; 66 | # listen [::]:443 ssl http2 default_server; 67 | # server_name _; 68 | # root /opt/app-root/src; 69 | # 70 | # ssl_certificate "/etc/pki/nginx/server.crt"; 71 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 72 | # ssl_session_cache shared:SSL:1m; 73 | # ssl_session_timeout 10m; 74 | # ssl_ciphers PROFILE=SYSTEM; 75 | # ssl_prefer_server_ciphers on; 76 | # 77 | # # Load configuration files for the default server block. 78 | # include /opt/app-root/etc/nginx.default.d/*.conf; 79 | # 80 | # location / { 81 | # } 82 | # 83 | # error_page 404 /404.html; 84 | # location = /40x.html { 85 | # } 86 | # 87 | # error_page 500 502 503 504 /50x.html; 88 | # location = /50x.html { 89 | # } 90 | # } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/1.14/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.14/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.14/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.14/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/1.14/test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | # perl_modules /opt/app-root/etc/perl; 19 | # perl_require Version.pm; 20 | # perl_set $perl_version Version::installed; 21 | 22 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 23 | '$status $body_bytes_sent "$http_referer" ' 24 | '"$http_user_agent" "$http_x_forwarded_for"'; 25 | 26 | 27 | sendfile on; 28 | tcp_nopush on; 29 | tcp_nodelay on; 30 | keepalive_timeout 65; 31 | types_hash_max_size 2048; 32 | 33 | include /etc/nginx/mime.types; 34 | default_type application/octet-stream; 35 | 36 | # Load modular configuration files from the /etc/nginx/conf.d directory. 37 | # See http://nginx.org/en/docs/ngx_core_module.html#include 38 | # for more information. 39 | include /opt/app-root/etc/nginx.d/*.conf; 40 | 41 | server { 42 | listen 8080 default_server; 43 | listen [::]:8080 default_server; 44 | server_name _; 45 | root /opt/app-root/src; 46 | 47 | # Load configuration files for the default server block. 48 | include /opt/app-root/etc/nginx.default.d/*.conf; 49 | 50 | location / { 51 | } 52 | 53 | error_page 404 /404.html; 54 | location = /40x.html { 55 | } 56 | 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | } 60 | } 61 | 62 | # Settings for a TLS enabled server. 63 | # 64 | # server { 65 | # listen 443 ssl http2 default_server; 66 | # listen [::]:443 ssl http2 default_server; 67 | # server_name _; 68 | # root /opt/app-root/src; 69 | # 70 | # ssl_certificate "/etc/pki/nginx/server.crt"; 71 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 72 | # ssl_session_cache shared:SSL:1m; 73 | # ssl_session_timeout 10m; 74 | # ssl_ciphers PROFILE=SYSTEM; 75 | # ssl_prefer_server_ciphers on; 76 | # 77 | # # Load configuration files for the default server block. 78 | # include /opt/app-root/etc/nginx.default.d/*.conf; 79 | # 80 | # location / { 81 | # } 82 | # 83 | # error_page 404 /404.html; 84 | # location = /40x.html { 85 | # } 86 | # 87 | # error_page 500 502 503 504 /50x.html; 88 | # location = /50x.html { 89 | # } 90 | # } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/1.16/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.16/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.16/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.16/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/1.16/test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | # perl_modules /opt/app-root/etc/perl; 19 | # perl_require Version.pm; 20 | # perl_set $perl_version Version::installed; 21 | 22 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 23 | '$status $body_bytes_sent "$http_referer" ' 24 | '"$http_user_agent" "$http_x_forwarded_for"'; 25 | 26 | 27 | sendfile on; 28 | tcp_nopush on; 29 | tcp_nodelay on; 30 | keepalive_timeout 65; 31 | types_hash_max_size 2048; 32 | 33 | include /etc/nginx/mime.types; 34 | default_type application/octet-stream; 35 | 36 | # Load modular configuration files from the /etc/nginx/conf.d directory. 37 | # See http://nginx.org/en/docs/ngx_core_module.html#include 38 | # for more information. 39 | include /opt/app-root/etc/nginx.d/*.conf; 40 | 41 | server { 42 | listen 8080 default_server; 43 | listen [::]:8080 default_server; 44 | server_name _; 45 | root /opt/app-root/src; 46 | 47 | # Load configuration files for the default server block. 48 | include /opt/app-root/etc/nginx.default.d/*.conf; 49 | 50 | location / { 51 | } 52 | 53 | error_page 404 /404.html; 54 | location = /40x.html { 55 | } 56 | 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | } 60 | } 61 | 62 | # Settings for a TLS enabled server. 63 | # 64 | # server { 65 | # listen 443 ssl http2 default_server; 66 | # listen [::]:443 ssl http2 default_server; 67 | # server_name _; 68 | # root /opt/app-root/src; 69 | # 70 | # ssl_certificate "/etc/pki/nginx/server.crt"; 71 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 72 | # ssl_session_cache shared:SSL:1m; 73 | # ssl_session_timeout 10m; 74 | # ssl_ciphers PROFILE=SYSTEM; 75 | # ssl_prefer_server_ciphers on; 76 | # 77 | # # Load configuration files for the default server block. 78 | # include /opt/app-root/etc/nginx.default.d/*.conf; 79 | # 80 | # location / { 81 | # } 82 | # 83 | # error_page 404 /404.html; 84 | # location = /40x.html { 85 | # } 86 | # 87 | # error_page 500 502 503 504 /50x.html; 88 | # location = /50x.html { 89 | # } 90 | # } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/1.18/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.18/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.18/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.18/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/1.18/test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | # perl_modules /opt/app-root/etc/perl; 19 | # perl_require Version.pm; 20 | # perl_set $perl_version Version::installed; 21 | 22 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 23 | '$status $body_bytes_sent "$http_referer" ' 24 | '"$http_user_agent" "$http_x_forwarded_for"'; 25 | 26 | 27 | sendfile on; 28 | tcp_nopush on; 29 | tcp_nodelay on; 30 | keepalive_timeout 65; 31 | types_hash_max_size 2048; 32 | 33 | include /etc/nginx/mime.types; 34 | default_type application/octet-stream; 35 | 36 | # Load modular configuration files from the /etc/nginx/conf.d directory. 37 | # See http://nginx.org/en/docs/ngx_core_module.html#include 38 | # for more information. 39 | include /opt/app-root/etc/nginx.d/*.conf; 40 | 41 | server { 42 | listen 8080 default_server; 43 | listen [::]:8080 default_server; 44 | server_name _; 45 | root /opt/app-root/src; 46 | 47 | # Load configuration files for the default server block. 48 | include /opt/app-root/etc/nginx.default.d/*.conf; 49 | 50 | location / { 51 | } 52 | 53 | error_page 404 /404.html; 54 | location = /40x.html { 55 | } 56 | 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | } 60 | } 61 | 62 | # Settings for a TLS enabled server. 63 | # 64 | # server { 65 | # listen 443 ssl http2 default_server; 66 | # listen [::]:443 ssl http2 default_server; 67 | # server_name _; 68 | # root /opt/app-root/src; 69 | # 70 | # ssl_certificate "/etc/pki/nginx/server.crt"; 71 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 72 | # ssl_session_cache shared:SSL:1m; 73 | # ssl_session_timeout 10m; 74 | # ssl_ciphers PROFILE=SYSTEM; 75 | # ssl_prefer_server_ciphers on; 76 | # 77 | # # Load configuration files for the default server block. 78 | # include /opt/app-root/etc/nginx.default.d/*.conf; 79 | # 80 | # location / { 81 | # } 82 | # 83 | # error_page 404 /404.html; 84 | # location = /40x.html { 85 | # } 86 | # 87 | # error_page 500 502 503 504 /50x.html; 88 | # location = /50x.html { 89 | # } 90 | # } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/1.20/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.20/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.20/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.20/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/1.20/test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | # perl_modules /opt/app-root/etc/perl; 19 | # perl_require Version.pm; 20 | # perl_set $perl_version Version::installed; 21 | 22 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 23 | '$status $body_bytes_sent "$http_referer" ' 24 | '"$http_user_agent" "$http_x_forwarded_for"'; 25 | 26 | 27 | sendfile on; 28 | tcp_nopush on; 29 | tcp_nodelay on; 30 | keepalive_timeout 65; 31 | types_hash_max_size 2048; 32 | 33 | include /etc/nginx/mime.types; 34 | default_type application/octet-stream; 35 | 36 | # Load modular configuration files from the /etc/nginx/conf.d directory. 37 | # See http://nginx.org/en/docs/ngx_core_module.html#include 38 | # for more information. 39 | include /opt/app-root/etc/nginx.d/*.conf; 40 | 41 | server { 42 | listen 8080 default_server; 43 | listen [::]:8080 default_server; 44 | server_name _; 45 | root /opt/app-root/src; 46 | 47 | # Load configuration files for the default server block. 48 | include /opt/app-root/etc/nginx.default.d/*.conf; 49 | 50 | location / { 51 | } 52 | 53 | error_page 404 /404.html; 54 | location = /40x.html { 55 | } 56 | 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | } 60 | } 61 | 62 | # Settings for a TLS enabled server. 63 | # 64 | # server { 65 | # listen 443 ssl http2 default_server; 66 | # listen [::]:443 ssl http2 default_server; 67 | # server_name _; 68 | # root /opt/app-root/src; 69 | # 70 | # ssl_certificate "/etc/pki/nginx/server.crt"; 71 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 72 | # ssl_session_cache shared:SSL:1m; 73 | # ssl_session_timeout 10m; 74 | # ssl_ciphers PROFILE=SYSTEM; 75 | # ssl_prefer_server_ciphers on; 76 | # 77 | # # Load configuration files for the default server block. 78 | # include /opt/app-root/etc/nginx.default.d/*.conf; 79 | # 80 | # location / { 81 | # } 82 | # 83 | # error_page 404 /404.html; 84 | # location = /40x.html { 85 | # } 86 | # 87 | # error_page 500 502 503 504 /50x.html; 88 | # location = /50x.html { 89 | # } 90 | # } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/1.22-micro: -------------------------------------------------------------------------------- 1 | 1.22 -------------------------------------------------------------------------------- /examples/1.22/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.22/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.22/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.22/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/1.22/test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | # perl_modules /opt/app-root/etc/perl; 19 | # perl_require Version.pm; 20 | # perl_set $perl_version Version::installed; 21 | 22 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 23 | '$status $body_bytes_sent "$http_referer" ' 24 | '"$http_user_agent" "$http_x_forwarded_for"'; 25 | 26 | 27 | sendfile on; 28 | tcp_nopush on; 29 | tcp_nodelay on; 30 | keepalive_timeout 65; 31 | types_hash_max_size 2048; 32 | 33 | include /etc/nginx/mime.types; 34 | default_type application/octet-stream; 35 | 36 | # Load modular configuration files from the /etc/nginx/conf.d directory. 37 | # See http://nginx.org/en/docs/ngx_core_module.html#include 38 | # for more information. 39 | include /opt/app-root/etc/nginx.d/*.conf; 40 | 41 | server { 42 | listen 8080 default_server; 43 | listen [::]:8080 default_server; 44 | server_name _; 45 | root /opt/app-root/src; 46 | 47 | # Load configuration files for the default server block. 48 | include /opt/app-root/etc/nginx.default.d/*.conf; 49 | 50 | location / { 51 | } 52 | 53 | error_page 404 /404.html; 54 | location = /40x.html { 55 | } 56 | 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | } 60 | } 61 | 62 | # Settings for a TLS enabled server. 63 | # 64 | # server { 65 | # listen 443 ssl http2 default_server; 66 | # listen [::]:443 ssl http2 default_server; 67 | # server_name _; 68 | # root /opt/app-root/src; 69 | # 70 | # ssl_certificate "/etc/pki/nginx/server.crt"; 71 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 72 | # ssl_session_cache shared:SSL:1m; 73 | # ssl_session_timeout 10m; 74 | # ssl_ciphers PROFILE=SYSTEM; 75 | # ssl_prefer_server_ciphers on; 76 | # 77 | # # Load configuration files for the default server block. 78 | # include /opt/app-root/etc/nginx.default.d/*.conf; 79 | # 80 | # location / { 81 | # } 82 | # 83 | # error_page 404 /404.html; 84 | # location = /40x.html { 85 | # } 86 | # 87 | # error_page 500 502 503 504 /50x.html; 88 | # location = /50x.html { 89 | # } 90 | # } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/1.24/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.24/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.24/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.24/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/1.24/test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | # perl_modules /opt/app-root/etc/perl; 19 | # perl_require Version.pm; 20 | # perl_set $perl_version Version::installed; 21 | 22 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 23 | '$status $body_bytes_sent "$http_referer" ' 24 | '"$http_user_agent" "$http_x_forwarded_for"'; 25 | 26 | 27 | sendfile on; 28 | tcp_nopush on; 29 | tcp_nodelay on; 30 | keepalive_timeout 65; 31 | types_hash_max_size 2048; 32 | 33 | include /etc/nginx/mime.types; 34 | default_type application/octet-stream; 35 | 36 | # Load modular configuration files from the /etc/nginx/conf.d directory. 37 | # See http://nginx.org/en/docs/ngx_core_module.html#include 38 | # for more information. 39 | include /opt/app-root/etc/nginx.d/*.conf; 40 | 41 | server { 42 | listen 8080 default_server; 43 | listen [::]:8080 default_server; 44 | server_name _; 45 | root /opt/app-root/src; 46 | 47 | # Load configuration files for the default server block. 48 | include /opt/app-root/etc/nginx.default.d/*.conf; 49 | 50 | location / { 51 | } 52 | 53 | error_page 404 /404.html; 54 | location = /40x.html { 55 | } 56 | 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | } 60 | } 61 | 62 | # Settings for a TLS enabled server. 63 | # 64 | # server { 65 | # listen 443 ssl http2 default_server; 66 | # listen [::]:443 ssl http2 default_server; 67 | # server_name _; 68 | # root /opt/app-root/src; 69 | # 70 | # ssl_certificate "/etc/pki/nginx/server.crt"; 71 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 72 | # ssl_session_cache shared:SSL:1m; 73 | # ssl_session_timeout 10m; 74 | # ssl_ciphers PROFILE=SYSTEM; 75 | # ssl_prefer_server_ciphers on; 76 | # 77 | # # Load configuration files for the default server block. 78 | # include /opt/app-root/etc/nginx.default.d/*.conf; 79 | # 80 | # location / { 81 | # } 82 | # 83 | # error_page 404 /404.html; 84 | # location = /40x.html { 85 | # } 86 | # 87 | # error_page 500 502 503 504 /50x.html; 88 | # location = /50x.html { 89 | # } 90 | # } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/1.26/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.26/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.26/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.26/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/1.26/test-app/nginx.conf: -------------------------------------------------------------------------------- 1 | # For more information on configuration, see: 2 | # * Official English Documentation: http://nginx.org/en/docs/ 3 | # * Official Russian Documentation: http://nginx.org/ru/docs/ 4 | 5 | 6 | worker_processes auto; 7 | error_log /var/log/nginx/error.log; 8 | pid /run/nginx.pid; 9 | 10 | # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11 | include /usr/share/nginx/modules/*.conf; 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | # perl_modules /opt/app-root/etc/perl; 19 | # perl_require Version.pm; 20 | # perl_set $perl_version Version::installed; 21 | 22 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 23 | '$status $body_bytes_sent "$http_referer" ' 24 | '"$http_user_agent" "$http_x_forwarded_for"'; 25 | 26 | 27 | sendfile on; 28 | tcp_nopush on; 29 | tcp_nodelay on; 30 | keepalive_timeout 65; 31 | types_hash_max_size 2048; 32 | 33 | include /etc/nginx/mime.types; 34 | default_type application/octet-stream; 35 | 36 | # Load modular configuration files from the /etc/nginx/conf.d directory. 37 | # See http://nginx.org/en/docs/ngx_core_module.html#include 38 | # for more information. 39 | include /opt/app-root/etc/nginx.d/*.conf; 40 | 41 | server { 42 | listen 8080 default_server; 43 | listen [::]:8080 default_server; 44 | server_name _; 45 | root /opt/app-root/src; 46 | 47 | # Load configuration files for the default server block. 48 | include /opt/app-root/etc/nginx.default.d/*.conf; 49 | 50 | location / { 51 | } 52 | 53 | error_page 404 /404.html; 54 | location = /40x.html { 55 | } 56 | 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | } 60 | } 61 | 62 | # Settings for a TLS enabled server. 63 | # 64 | # server { 65 | # listen 443 ssl http2 default_server; 66 | # listen [::]:443 ssl http2 default_server; 67 | # server_name _; 68 | # root /opt/app-root/src; 69 | # 70 | # ssl_certificate "/etc/pki/nginx/server.crt"; 71 | # ssl_certificate_key "/etc/pki/nginx/private/server.key"; 72 | # ssl_session_cache shared:SSL:1m; 73 | # ssl_session_timeout 10m; 74 | # ssl_ciphers PROFILE=SYSTEM; 75 | # ssl_prefer_server_ciphers on; 76 | # 77 | # # Load configuration files for the default server block. 78 | # include /opt/app-root/etc/nginx.default.d/*.conf; 79 | # 80 | # location / { 81 | # } 82 | # 83 | # error_page 404 /404.html; 84 | # location = /40x.html { 85 | # } 86 | # 87 | # error_page 500 502 503 504 /50x.html; 88 | # location = /50x.html { 89 | # } 90 | # } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/1.8/test-app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.8/test-app/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test NGINX passed 4 | 5 | 6 |

NGINX2 is working

7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/1.8/test-app/nginx-cfg/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080 default_server; 3 | server_name localhost2; 4 | root /opt/app-root/src; 5 | index index2.html; 6 | } 7 | -------------------------------------------------------------------------------- /examples/1.8/test-app/nginx-default-cfg/alias.conf: -------------------------------------------------------------------------------- 1 | location /aliased/ { 2 | alias /opt/app-root/src/; 3 | } 4 | -------------------------------------------------------------------------------- /examples/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi8/nginx-120 2 | 3 | ENV NGINX_VERSION=1.20 4 | 5 | # Add application sources 6 | ADD nginx-container/examples/$NGINX_VERSION/test-app/nginx.conf "${NGINX_CONF_PATH}" 7 | ADD nginx-container/examples/$NGINX_VERSION/test-app/nginx-default-cfg/*.conf "${NGINX_DEFAULT_CONF_PATH}" 8 | ADD nginx-container/examples/$NGINX_VERSION/test-app/nginx-cfg/*.conf "${NGINX_CONFIGURATION_PATH}" 9 | ADD nginx-container/examples/$NGINX_VERSION/test-app/*.html ./ 10 | 11 | # Run script uses standard ways to run the application 12 | CMD nginx -g "daemon off;" 13 | -------------------------------------------------------------------------------- /examples/Dockerfile.s2i: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi8/nginx-120 2 | 3 | ENV NGINX_VERSION=1.20 4 | 5 | # This image supports the Source-to-Image 6 | # (see more at https://docs.openshift.com/container-platform/3.11/creating_images/s2i.html). 7 | # In order to support the Source-to-Image framework, there are some interesting 8 | # scripts inside the builder image, that can be run in a Dockerfile directly as well: 9 | # * The `/usr/libexec/s2i/assemble` script inside the image is run in order 10 | # to produce a new image with the application artifacts. 11 | # The script takes sources of a given application and places them into 12 | # appropriate directories inside the image. 13 | # * The `/usr/libexec/s2i/run` script executes the application and is set as 14 | # a default command in the resulting container image. 15 | 16 | # Add application sources to a directory that the assemble script expects them 17 | # and set permissions so that the container runs without root access 18 | # With a newer docker that supports --chown option for ADD statement, or with 19 | # podman, we can replace the following four statements with 20 | # ADD --chown 1001:0 /tmp/src 21 | USER 0 22 | ADD nginx-container/examples/$NGINX_VERSION/test-app /tmp/src/ 23 | RUN chown -R 1001:0 /tmp/src 24 | USER 1001 25 | 26 | # Let the assemble script to install the dependencies 27 | RUN /usr/libexec/s2i/assemble 28 | 29 | # Run script uses standard ways to run the application 30 | CMD /usr/libexec/s2i/run 31 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Test application for Nginx 2 | 3 | This is a simple example of static content and configuration files served using nginx. 4 | 5 | ## Building with s2i and Dockerfile 6 | 7 | See [the main documentation](/1.20/README.md) for steps how to use this image 8 | with a podman directly or in a Dockerfile, utilizing the source-to-image scripts. 9 | 10 | ## Building and deploying in OpenShift 11 | 12 | ### Version 1.20 13 | ``` 14 | oc new-app nginx:1.20~https://github.com/sclorg/nginx-container.git --context-dir=1.20/test/test-app/ 15 | ``` 16 | -------------------------------------------------------------------------------- /imagestreams/imagestreams.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # configuration file for https://github.com/sclorg/ci-scripts/tree/master/ocp-stream-generator 3 | 4 | - name: nginx 5 | pretty_name: Nginx HTTP server and a reverse proxy 6 | sample_repo: https://github.com/sclorg/nginx-ex.git 7 | category: builder 8 | description: >- 9 | Build and serve static content via Nginx HTTP Server 10 | and a reverse proxy (nginx) on DISTRO_NAME. 11 | For more information about using this builder image, 12 | including OpenShift considerations, see 13 | https://github.com/sclorg/nginx-container/blob/master/APP_VERSION/README.md. 14 | imagestream_files: 15 | - filename: nginx-centos.json 16 | latest: "1.24-ubi9" 17 | distros: 18 | - name: UBI 8 19 | app_versions: ["1.22"] 20 | 21 | - name: UBI 9 22 | app_versions: ["1.20", "1.22", "1.24"] 23 | 24 | - filename: nginx-rhel.json 25 | latest: "1.24-ubi9" 26 | distros: 27 | - name: UBI 8 28 | app_versions: ["1.22"] 29 | 30 | - name: UBI 9 31 | app_versions: ["1.20", "1.22", "1.24"] 32 | 33 | - filename: nginx-rhel-aarch64.json 34 | latest: "1.24-ubi9" 35 | distros: 36 | - name: UBI 8 37 | app_versions: ["1.22"] 38 | 39 | - name: UBI 9 40 | app_versions: ["1.20", "1.22", "1.24"] 41 | -------------------------------------------------------------------------------- /test/check_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../common/check_imagestreams.py -------------------------------------------------------------------------------- /test/examples: -------------------------------------------------------------------------------- 1 | ../examples -------------------------------------------------------------------------------- /test/imagestreams: -------------------------------------------------------------------------------- 1 | ../imagestreams/ -------------------------------------------------------------------------------- /test/run-openshift-pytest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # IMAGE_NAME specifies a name of the candidate image used for testing. 4 | # The image has to be available before this script is executed. 5 | # VERSION specifies the major version of the MariaDB in format of X.Y 6 | # OS specifies RHEL version (e.g. OS=rhel7) 7 | # 8 | 9 | THISDIR=$(dirname ${BASH_SOURCE[0]}) 10 | 11 | git show -s 12 | 13 | cd "${THISDIR}" && python3.12 -m pytest -s -rA --showlocals -vv test_*.py 14 | -------------------------------------------------------------------------------- /test/run-openshift-remote-cluster: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Test the nginx S2I image in OpenShift (remote cluster) 4 | # 5 | # IMAGE_NAME specifies a name of the candidate image used for testing. 6 | # The image has to be available before this script is executed. 7 | # VERSION specifies the major version of the nginx runtime in format of X.Y 8 | # OS specifies RHEL version (e.g. OS=rhel8) 9 | # 10 | 11 | THISDIR=$(dirname ${BASH_SOURCE[0]}) 12 | 13 | source "${THISDIR}/test-lib-nginx.sh" 14 | source "${THISDIR}/test-lib-remote-openshift.sh" 15 | 16 | TEST_LIST="\ 17 | test_nginx_integration 18 | test_nginx_local_example 19 | test_nginx_remote_example 20 | test_nginx_template_from_example_app 21 | test_nginx_imagestream 22 | test_latest_imagestreams 23 | " 24 | 25 | trap ct_os_cleanup EXIT SIGINT 26 | 27 | ct_os_set_ocp4 || exit $OC_ERR 28 | 29 | ct_os_check_compulsory_vars || exit $OC_ERR 30 | 31 | ct_os_tag_image_for_cvp "nginx" 32 | 33 | ct_os_check_login || exit $OC_ERR 34 | 35 | 36 | set -u 37 | 38 | # For testing on OpenShift 4 we use internal registry 39 | export CT_OCP4_TEST=true 40 | 41 | TEST_SUMMARY='' 42 | TEST_SET=${TESTS:-$TEST_LIST} ct_run_tests_from_testset "openshift-remote-cluster" 43 | # vim: set tabstop=2:shiftwidth=2:expandtab: 44 | 45 | -------------------------------------------------------------------------------- /test/show_all_imagestreams.py: -------------------------------------------------------------------------------- 1 | ../common/show_all_imagestreams.py -------------------------------------------------------------------------------- /test/test-lib-nginx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Functions for tests for the nginx image in OpenShift. 4 | # 5 | # IMAGE_NAME specifies a name of the candidate image used for testing. 6 | # The image has to be available before this script is executed. 7 | # 8 | 9 | THISDIR=$(dirname ${BASH_SOURCE[0]}) 10 | 11 | source "${THISDIR}/test-lib.sh" 12 | source "${THISDIR}/test-lib-openshift.sh" 13 | 14 | function test_nginx_integration() { 15 | ct_os_test_s2i_app "${IMAGE_NAME}" \ 16 | "https://github.com/sclorg/nginx-container.git" \ 17 | "examples/${VERSION}/test-app" \ 18 | "Test NGINX passed" 19 | } 20 | 21 | # Check the imagestream 22 | function test_nginx_imagestream() { 23 | # Check if the current version is already GA 24 | # This directory is cloned from TMT plan repo 'sclorg-tmt-plans' 25 | local devel_file="/root/sclorg-tmt-plans/devel_images" 26 | if [ -f "${devel_file}" ]; then 27 | if grep -q "${OS}=nginx-container=${VERSION}" "$devel_file" ; then 28 | echo "This version is currently developed, so skipping this test." 29 | return 30 | fi 31 | fi 32 | ct_os_test_image_stream_s2i "${THISDIR}/imagestreams/nginx-${OS%[0-9]*}.json" "${IMAGE_NAME}" \ 33 | "https://github.com/sclorg/nginx-container.git" \ 34 | "examples/${VERSION}/test-app" \ 35 | "Test NGINX passed" 36 | } 37 | 38 | function test_nginx_local_example() { 39 | # test local app 40 | ct_os_test_s2i_app ${IMAGE_NAME} "${THISDIR}/test-app" . 'Test NGINX passed' 41 | } 42 | 43 | function test_nginx_remote_example() { 44 | # TODO: branch should be changed to master, once code in example app 45 | # stabilizes on with referencing latest version 46 | BRANCH_TO_TEST=master 47 | # test remote example app 48 | ct_os_test_s2i_app "${IMAGE_NAME}" \ 49 | "https://github.com/sclorg/nginx-ex.git#${BRANCH_TO_TEST}" \ 50 | . \ 51 | 'Welcome to your static nginx application on OpenShift' 52 | } 53 | 54 | function test_nginx_template_from_example_app() { 55 | BRANCH_TO_TEST=master 56 | # test template from the example app 57 | ct_os_test_template_app "${IMAGE_NAME}" \ 58 | "https://raw.githubusercontent.com/sclorg/nginx-ex/${BRANCH_TO_TEST}/openshift/templates/nginx.json" \ 59 | nginx \ 60 | 'Welcome to your static nginx application on OpenShift' \ 61 | 8080 http 200 "-p SOURCE_REPOSITORY_REF=${BRANCH_TO_TEST} -p NGINX_VERSION=${VERSION} -p NAME=nginx-testing" 62 | 63 | } 64 | 65 | function test_latest_imagestreams() { 66 | local result=1 67 | if [[ "${VERSION}" == *"micro"* ]]; then 68 | echo "Do not check 'micro' imagestreams. Only main versions." 69 | return 0 70 | fi 71 | # Check if the current version is already GA 72 | # This directory is cloned from TMT plan repo 'sclorg-tmt-plans' 73 | local devel_file="/root/sclorg-tmt-plans/devel_images" 74 | if [ -f "${devel_file}" ]; then 75 | if grep -q "${OS}=nginx-container=${VERSION}" "$devel_file" ; then 76 | echo "This version is currently developed, so skipping this test." 77 | return 78 | fi 79 | fi 80 | # Switch to root directory of a container 81 | echo "Testing the latest version in imagestreams" 82 | pushd "${THISDIR}/../.." >/dev/null || return 1 83 | ct_check_latest_imagestreams 84 | result=$? 85 | popd >/dev/null || return 1 86 | return $result 87 | } 88 | 89 | # vim: set tabstop=2:shiftwidth=2:expandtab: 90 | -------------------------------------------------------------------------------- /test/test-lib-openshift.sh: -------------------------------------------------------------------------------- 1 | ../common/test-lib-openshift.sh -------------------------------------------------------------------------------- /test/test-lib-remote-openshift.sh: -------------------------------------------------------------------------------- 1 | ../common/test-lib-remote-openshift.sh -------------------------------------------------------------------------------- /test/test-lib.sh: -------------------------------------------------------------------------------- 1 | ../common/test-lib.sh -------------------------------------------------------------------------------- /test/test-openshift.yaml: -------------------------------------------------------------------------------- 1 | ../common/test-openshift.yaml -------------------------------------------------------------------------------- /test/test_nginx_imagestream_s2i.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pytest 4 | 5 | from container_ci_suite.openshift import OpenShiftAPI 6 | from container_ci_suite.utils import get_service_image, check_variables 7 | 8 | if not check_variables(): 9 | print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") 10 | sys.exit(1) 11 | 12 | BRANCH_TO_TEST = "master" 13 | IMAGE_NAME = os.getenv("IMAGE_NAME") 14 | OS = os.getenv("OS") 15 | VERSION = os.getenv("VERSION") 16 | 17 | TAGS = { 18 | "rhel8": "-ubi8", 19 | "rhel9": "-ubi9", 20 | "rhel10": "-ubi10" 21 | } 22 | TAG = TAGS.get(OS, None) 23 | 24 | # bash test=test_nginx_imagestream 25 | class TestNginxImagestreamS2I: 26 | 27 | def setup_method(self): 28 | self.template_name = get_service_image(IMAGE_NAME) 29 | self.oc_api = OpenShiftAPI(pod_name_prefix=self.template_name, version=VERSION) 30 | 31 | def teardown_method(self): 32 | self.oc_api.delete_project() 33 | 34 | def test_inside_cluster(self): 35 | if OS == "rhel10": 36 | pytest.skip("Skipping test for rhel10") 37 | os_name = ''.join(i for i in OS if not i.isdigit()) 38 | new_version = VERSION 39 | if "-minimal" in VERSION: 40 | new_version = VERSION.replace("-minimal", "") 41 | assert self.oc_api.deploy_imagestream_s2i( 42 | imagestream_file=f"imagestreams/nginx-{os_name}.json", 43 | image_name=IMAGE_NAME, 44 | app="https://github.com/sclorg/nginx-container.git", 45 | context=f"examples/{new_version}/test-app", 46 | service_name=self.template_name 47 | ) 48 | assert self.oc_api.is_template_deployed(name_in_template=self.template_name) 49 | assert self.oc_api.check_response_inside_cluster( 50 | name_in_template=self.template_name, expected_output="Test NGINX passed" 51 | ) 52 | -------------------------------------------------------------------------------- /test/test_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pytest 4 | 5 | from pathlib import Path 6 | 7 | from container_ci_suite.imagestreams import ImageStreamChecker 8 | from container_ci_suite.utils import check_variables 9 | 10 | TEST_DIR = Path(os.path.abspath(os.path.dirname(__file__))) 11 | 12 | if not check_variables(): 13 | print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") 14 | sys.exit(1) 15 | 16 | 17 | class TestLatestImagestreams: 18 | 19 | def setup_method(self): 20 | self.isc = ImageStreamChecker(working_dir=TEST_DIR / ".." / "..") 21 | 22 | def test_latest_imagestream(self): 23 | self.latest_version = self.isc.get_latest_version() 24 | assert self.latest_version != "" 25 | self.isc.check_imagestreams(self.latest_version) 26 | -------------------------------------------------------------------------------- /test/test_nginx_local_example.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pytest 4 | 5 | from container_ci_suite.openshift import OpenShiftAPI 6 | from container_ci_suite.utils import get_service_image, check_variables 7 | 8 | if not check_variables(): 9 | print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") 10 | sys.exit(1) 11 | 12 | VERSION = os.getenv("VERSION") 13 | IMAGE_NAME = os.getenv("IMAGE_NAME") 14 | OS = os.getenv("TARGET") 15 | 16 | 17 | # Replacement with 'test_python_s2i_app_ex_standalone' 18 | class TestNginxLocalEx: 19 | 20 | def setup_method(self): 21 | self.template_name = get_service_image(IMAGE_NAME) 22 | self.oc_api = OpenShiftAPI(pod_name_prefix=self.template_name, version=VERSION) 23 | 24 | def teardown_method(self): 25 | self.oc_api.delete_project() 26 | 27 | def test_nginx_ex_template_inside_cluster(self): 28 | assert self.oc_api.deploy_s2i_app( 29 | image_name=IMAGE_NAME, app="test-app", 30 | context=".", 31 | service_name=self.template_name 32 | ) 33 | assert self.oc_api.is_template_deployed(name_in_template=self.template_name) 34 | assert self.oc_api.check_response_inside_cluster( 35 | name_in_template=self.template_name, expected_output="Test NGINX passed" 36 | ) 37 | -------------------------------------------------------------------------------- /test/test_nginx_remote_example.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pytest 4 | 5 | from container_ci_suite.openshift import OpenShiftAPI 6 | from container_ci_suite.utils import get_service_image, check_variables 7 | 8 | if not check_variables(): 9 | print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") 10 | sys.exit(1) 11 | 12 | VERSION = os.getenv("VERSION") 13 | IMAGE_NAME = os.getenv("IMAGE_NAME") 14 | OS = os.getenv("TARGET") 15 | 16 | 17 | # Replacement with 18 | # test_nginx_remote_example 19 | class TestNginxLocalEx: 20 | 21 | def setup_method(self): 22 | self.template_name = get_service_image(IMAGE_NAME) 23 | self.oc_api = OpenShiftAPI(pod_name_prefix=self.template_name, version=VERSION) 24 | 25 | def teardown_method(self): 26 | self.oc_api.delete_project() 27 | 28 | def test_nginx_ex_template_inside_cluster(self): 29 | assert self.oc_api.deploy_s2i_app( 30 | image_name=IMAGE_NAME, app=f"https://github.com/sclorg/nginx-ex.git", 31 | context=".", 32 | service_name=self.template_name 33 | ) 34 | assert self.oc_api.is_s2i_pod_running(pod_name_prefix=self.template_name) 35 | assert self.oc_api.check_response_inside_cluster( 36 | name_in_template=self.template_name, expected_output="Welcome to your static nginx application on OpenShift" 37 | ) 38 | -------------------------------------------------------------------------------- /test/test_nginx_template_example_app.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pytest 4 | 5 | from pathlib import Path 6 | 7 | from container_ci_suite.openshift import OpenShiftAPI 8 | from container_ci_suite.utils import get_service_image, check_variables 9 | 10 | if not check_variables(): 11 | print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") 12 | sys.exit(1) 13 | 14 | 15 | VERSION = os.getenv("VERSION") 16 | IMAGE_NAME = os.getenv("IMAGE_NAME") 17 | OS = os.getenv("TARGET") 18 | 19 | 20 | # bash test_nginx_template_from_example_app 21 | # Replacement with 'test_python_s2i_templates' 22 | class TestNginxDeployTemplate: 23 | 24 | def setup_method(self): 25 | self.oc_api = OpenShiftAPI(pod_name_prefix="nginx-testing", version=VERSION) 26 | 27 | def teardown_method(self): 28 | self.oc_api.delete_project() 29 | 30 | def test_nginx_template_inside_cluster(self): 31 | if OS == "rhel10": 32 | pytest.skip("Skipping test for rhel10") 33 | service_name = "nginx-testing" 34 | template_url = self.oc_api.get_raw_url_for_json( 35 | container="nginx-ex", dir="openshift/templates", filename="nginx.json", branch="master" 36 | ) 37 | assert self.oc_api.deploy_template_with_image( 38 | image_name=IMAGE_NAME, 39 | template=template_url, 40 | name_in_template="nginx", 41 | openshift_args=[ 42 | f"SOURCE_REPOSITORY_REF=master", 43 | f"NGINX_VERSION={VERSION}", 44 | f"NAME={service_name}" 45 | ] 46 | ) 47 | assert self.oc_api.is_template_deployed(name_in_template=service_name, timeout=300) 48 | assert self.oc_api.check_response_inside_cluster( 49 | name_in_template=service_name, expected_output="Welcome to your static nginx application on OpenShift" 50 | ) 51 | -------------------------------------------------------------------------------- /test/test_shared_helm_nginx_imagestreams.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | import pytest 5 | 6 | from pathlib import Path 7 | 8 | from container_ci_suite.helm import HelmChartsAPI 9 | from container_ci_suite.utils import check_variables 10 | 11 | if not check_variables(): 12 | print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") 13 | sys.exit(1) 14 | 15 | test_dir = Path(os.path.abspath(os.path.dirname(__file__))) 16 | 17 | 18 | class TestHelmRHELNginxImageStreams: 19 | 20 | def setup_method(self): 21 | package_name = "redhat-nginx-imagestreams" 22 | path = test_dir 23 | self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir) 24 | self.hc_api.clone_helm_chart_repo( 25 | repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts", 26 | subdir="charts/redhat" 27 | ) 28 | 29 | def teardown_method(self): 30 | self.hc_api.delete_project() 31 | 32 | @pytest.mark.parametrize( 33 | "version,registry,expected", 34 | [ 35 | ("1.24-ubi9", "registry.redhat.io/ubi9/nginx-124:latest", True), 36 | ("1.24-ubi8", "registry.redhat.io/ubi8/nginx-124:latest", True), 37 | ("1.22-ubi9", "registry.redhat.io/ubi9/nginx-122:latest", True), 38 | ("1.22-ubi8", "registry.redhat.io/ubi8/nginx-122:latest", True), 39 | ("1.20-ubi9", "registry.redhat.io/ubi9/nginx-120:latest", True), 40 | ("1.20-ubi8", "registry.redhat.io/ubi8/nginx-120:latest", False), 41 | ], 42 | ) 43 | def test_package_imagestream(self, version, registry, expected): 44 | assert self.hc_api.helm_package() 45 | assert self.hc_api.helm_installation() 46 | assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected 47 | -------------------------------------------------------------------------------- /test/test_shared_helm_nginx_template.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | import pytest 5 | 6 | from pathlib import Path 7 | 8 | from container_ci_suite.helm import HelmChartsAPI 9 | from container_ci_suite.utils import check_variables 10 | 11 | if not check_variables(): 12 | print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") 13 | sys.exit(1) 14 | 15 | test_dir = Path(os.path.abspath(os.path.dirname(__file__))) 16 | 17 | 18 | VERSION = os.getenv("VERSION") 19 | IMAGE_NAME = os.getenv("IMAGE_NAME") 20 | OS = os.getenv("TARGET") 21 | 22 | TAGS = { 23 | "rhel8": "-ubi8", 24 | "rhel9": "-ubi9", 25 | "rhel10": "-ubi10", 26 | } 27 | TAG = TAGS.get(OS, None) 28 | 29 | 30 | class TestHelmNginxTemplate: 31 | 32 | def setup_method(self): 33 | package_name = "redhat-nginx-template" 34 | path = test_dir 35 | self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True) 36 | self.hc_api.clone_helm_chart_repo( 37 | repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts", 38 | subdir="charts/redhat" 39 | ) 40 | 41 | def teardown_method(self): 42 | self.hc_api.delete_project() 43 | 44 | def test_helm_connection(self): 45 | if OS == "rhel10": 46 | pytest.skip("Skipping test for rhel10") 47 | self.hc_api.package_name = "redhat-nginx-imagestreams" 48 | new_version = VERSION 49 | if "micro" in VERSION: 50 | new_version = VERSION.replace("-micro", "") 51 | assert self.hc_api.helm_package() 52 | assert self.hc_api.helm_installation() 53 | self.hc_api.package_name = "redhat-nginx-template" 54 | assert self.hc_api.helm_package() 55 | assert self.hc_api.helm_installation( 56 | values={ 57 | "nginx_version": f"{new_version}{TAG}", 58 | "namespace": self.hc_api.namespace 59 | } 60 | ) 61 | expected_str = "Welcome to your static nginx application on OpenShift" 62 | assert self.hc_api.is_s2i_pod_running(pod_name_prefix="nginx-example") 63 | assert self.hc_api.test_helm_chart(expected_str=[expected_str]) 64 | --------------------------------------------------------------------------------