From 3fe2740075f486e572e7ccf969bb183c2af20dd0 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Sun, 26 Nov 2023 14:24:29 +0330 Subject: [PATCH 01/10] chore(ci): enhance and update --- .github/workflows/publish-container.yml | 31 ++++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish-container.yml b/.github/workflows/publish-container.yml index 28c700f..ebec9f9 100644 --- a/.github/workflows/publish-container.yml +++ b/.github/workflows/publish-container.yml @@ -16,7 +16,6 @@ on: - created env: - REGISTRY: ghcr.io USER: alwatr jobs: @@ -36,6 +35,7 @@ jobs: - path: nginx-cdn - path: nginx-pwa - path: nginx-ws + - path: nginx-json permissions: contents: read @@ -68,14 +68,21 @@ jobs: uses: actions/cache@v3 with: path: /tmp/.buildx-cache - key: alwatr-${{ matrix.path }} + key: container/${{ matrix.path }} - - name: 🏗 Log into registry ${{env.REGISTRY}} + - name: 🏗 Log into docker hub registry if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }} uses: docker/login-action@v3.0.0 with: - registry: ${{env.REGISTRY}} - username: ${{github.repository_owner}} + username: ${{env.USER}} + password: ${{secrets.DOCKER_HUB_TOKEN}} + + - name: 🏗 Log into ghcr.io registry + if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }} + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{env.USER}} password: ${{secrets.GITHUB_TOKEN}} - name: 🏗 Extract metadata @@ -84,7 +91,9 @@ jobs: uses: docker/metadata-action@v5.0.0 with: github-token: ${{secrets.GITHUB_TOKEN}} - images: name=${{env.REGISTRY}}/${{env.USER}}/${{matrix.path}},enable=true + images: | + name=ghcr.io/${{env.USER}}/${{matrix.path}},enable=true + name=docker.io/${{env.USER}}/${{matrix.path}},enable=true tags: | type=semver,enable=true,pattern={{major}} type=semver,enable=true,pattern={{major}}.{{minor}} @@ -105,8 +114,8 @@ jobs: BUILD_DATE=${{github.event.repository.updated_at}} BUILD_REV=${{github.sha}} - - name: 🏗 Sign the image with GitHub OIDC Token - if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }} - env: - COSIGN_EXPERIMENTAL: 'true' - run: echo "${{steps.meta.outputs.tags}}" | xargs -I {} cosign sign --yes {}@${{steps.build_and_push.outputs.digest}} + # - name: 🏗 Sign the image with GitHub OIDC Token + # if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }} + # env: + # COSIGN_EXPERIMENTAL: 'true' + # run: echo "${{steps.meta.outputs.tags}}" | xargs -I {} cosign sign --yes {}@${{steps.build_and_push.outputs.digest}} From 573eea6e6acca904f7ba9c05872985c1aa4be1f2 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Sun, 26 Nov 2023 14:25:51 +0330 Subject: [PATCH 02/10] feat(nginx): enhance for v2, fix version BREAKING CHANGE: WORKDIR changed to /data --- nginx/.dockerignore | 2 +- nginx/Dockerfile | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nginx/.dockerignore b/nginx/.dockerignore index 41d1e72..eb786ee 100644 --- a/nginx/.dockerignore +++ b/nginx/.dockerignore @@ -1,3 +1,3 @@ * !etc/nginx/ -!var/www/ +!data/ diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 87c73a2..d906307 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,23 +1,23 @@ FROM docker.io/library/nginx:1.25.3-alpine3.18-slim -RUN rm -rfv /docker-entrypoint* /etc/nginx/conf.d/* /etc/nginx/nginx.conf /var/www/html /usr/share/nginx/html +RUN rm -rfv /docker-entrypoint* /etc/nginx/conf.d/* /etc/nginx/nginx.conf /var/www/html /usr/share/nginx/html /data COPY etc/nginx/ /etc/nginx/ RUN chmod a+rx /etc/nginx/entrypoint.sh /etc/nginx/entrypoint.d/*.sh RUN ls -RlAhF /etc/nginx/ EXPOSE 80 STOPSIGNAL SIGQUIT -WORKDIR /var/www/html/ +WORKDIR /data ENTRYPOINT ["/etc/nginx/entrypoint.sh"] CMD ["nginx", "-g", "daemon off;"] ARG BUILD_REV ARG BUILD_DATE LABEL org.opencontainers.image.title="alwatr/nginx" \ - org.opencontainers.image.description="NGINX web server slim (light), packaged by Alwatr." \ + org.opencontainers.image.description="The slim (lightweight) version of the NGINX web server, packaged by Alwatr." \ org.opencontainers.image.base.name="docker.io/library/nginx:1.25.3-alpine3.18-slim" \ - org.opencontainers.image.version="1.1.1-n1.25.3" \ - org.opencontainers.image.ref.name="1.1.1-n1.25.3-a3.18-slim" \ + org.opencontainers.image.version="1.25.3" \ + org.opencontainers.image.ref.name="1.25.3-alpine3.18-slim" \ org.opencontainers.image.licenses="MIT" \ org.opencontainers.image.created=${BUILD_DATE} \ org.opencontainers.image.revision=${BUILD_REV} \ From eb717f72c5ae5d02d13629e6b5e1a4adfd3dbd58 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Sun, 26 Nov 2023 14:27:40 +0330 Subject: [PATCH 03/10] feat(nginx-core): enhance and update workdir and document root BREAKING CHANGE: WORKDIR and default NGINX_DOCUMENT_ROOT changed to /data --- nginx-core/.dockerignore | 2 +- nginx-core/Dockerfile | 18 +++++---- nginx-core/{var/www => data}/_error.html | 2 +- nginx-core/{var/www/html => data}/index.html | 40 ++++++++++---------- 4 files changed, 32 insertions(+), 30 deletions(-) rename nginx-core/{var/www => data}/_error.html (96%) rename nginx-core/{var/www/html => data}/index.html (82%) diff --git a/nginx-core/.dockerignore b/nginx-core/.dockerignore index 41d1e72..eb786ee 100644 --- a/nginx-core/.dockerignore +++ b/nginx-core/.dockerignore @@ -1,3 +1,3 @@ * !etc/nginx/ -!var/www/ +!data/ diff --git a/nginx-core/Dockerfile b/nginx-core/Dockerfile index b35478f..69c225a 100644 --- a/nginx-core/Dockerfile +++ b/nginx-core/Dockerfile @@ -1,11 +1,13 @@ -FROM ghcr.io/alwatr/nginx:1.1.1 +FROM ghcr.io/alwatr/nginx:2.0.0 RUN apk add --no-cache curl HEALTHCHECK --interval=30s --timeout=3s --start-period=1s --retries=3 CMD curl -fso /dev/null http://localhost/server-info || exit 1 +WORKDIR /data + COPY etc/nginx/ /etc/nginx/ -COPY var/www/ /var/www/ -RUN ls -RlAhF /etc/nginx/ +COPY data/ . +RUN ls -RlahF /etc/nginx /data # Default environment for nginx template ENV NGINX_ACCESS_LOG="/var/log/nginx/access.log json" \ @@ -14,7 +16,7 @@ ENV NGINX_ACCESS_LOG="/var/log/nginx/access.log json" \ NGINX_LIMIT_REQ_ERROR=503 \ NGINX_LIMIT_REQ_LOG=notice \ NGINX_AUTOINDEX=off \ - NGINX_DOCUMENT_ROOT=/var/www/html \ + NGINX_DOCUMENT_ROOT=/data \ NGINX_FORCE_DOMAIN="" \ NGINX_FORCE_DOMAIN_STATUS=302 \ NGINX_FORCE_REDIRECT_STATUS=302 \ @@ -40,10 +42,10 @@ ENV NGINX_CLIENT_MAX_BODY_SIZE=10m \ ARG BUILD_REV ARG BUILD_DATE LABEL org.opencontainers.image.title="alwatr/nginx-core" \ - org.opencontainers.image.description="High-performance, accelerated NGINX, optimized for serving static content. Enhanced and accelerated by Alwatr." \ - org.opencontainers.image.base.name="ghcr.io/alwatr/nginx:1.1.1" \ - org.opencontainers.image.version="1.1.1-n1.25.3" \ - org.opencontainers.image.ref.name="1.1.1-n1.25.3-a3.18-slim" \ + org.opencontainers.image.description="HThis is a high-performance version of NGINX, which has been enhanced by Alwatr for the purpose of serving static content efficiently." \ + org.opencontainers.image.base.name="ghcr.io/alwatr/nginx:2.0.0" \ + org.opencontainers.image.version="2.0.0-nginx1.25.3" \ + org.opencontainers.image.ref.name="2.0.0-nginx1.25.3-alpine3.18-slim" \ org.opencontainers.image.licenses="MIT" \ org.opencontainers.image.created=${BUILD_DATE} \ org.opencontainers.image.revision=${BUILD_REV} \ diff --git a/nginx-core/var/www/_error.html b/nginx-core/data/_error.html similarity index 96% rename from nginx-core/var/www/_error.html rename to nginx-core/data/_error.html index 367f4f0..d5779da 100644 --- a/nginx-core/var/www/_error.html +++ b/nginx-core/data/_error.html @@ -4,7 +4,7 @@ - + Error!