From 272d845af27bc0c989f8305b47f70318c411b575 Mon Sep 17 00:00:00 2001 From: Arnaud RITTI Date: Mon, 2 Dec 2024 09:04:43 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20fichiers=20de=20configuration=20et?= =?UTF-8?q?=20de=20test,=20mise=20=C3=A0=20jour=20de=20la=20configuration?= =?UTF-8?q?=20Nginx=20et=20Caddy,=20et=20suppression=20de=20Dockerfile=20o?= =?UTF-8?q?bsol=C3=A8te?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_php.yml | 499 +++++-------------- Makefile | 76 ++- php/Dockerfile.caddy | 12 +- php/Dockerfile.caddy-wkhtmltopdf | 12 +- php/Dockerfile.fpm | 7 +- php/Dockerfile.frankenphp | 94 ++++ php/Dockerfile.frankenphp-wkhtmltopdf | 93 ++++ php/Dockerfile.nginx | 189 +------ php/Dockerfile.nginx-wkhtmltopdf | 189 +------ php/Dockerfile.node | 14 - php/README.md | 313 ++++-------- php/config/caddy/Caddyfile | 67 ++- php/config/frankenphp/Caddyfile | 75 +++ php/config/nginx/20-envsubst-on-templates.sh | 2 +- php/config/nginx/docker-entrypoint.sh | 60 ++- php/config/nginx/nginx.conf | 1 + test/index.php | 14 + test/phpinfo.php | 3 + test/ping.txt | 1 + 19 files changed, 691 insertions(+), 1030 deletions(-) create mode 100755 php/Dockerfile.frankenphp create mode 100755 php/Dockerfile.frankenphp-wkhtmltopdf delete mode 100755 php/Dockerfile.node create mode 100644 php/config/frankenphp/Caddyfile create mode 100644 test/index.php create mode 100644 test/phpinfo.php create mode 100644 test/ping.txt diff --git a/.github/workflows/build_php.yml b/.github/workflows/build_php.yml index 5a27862..44541a2 100644 --- a/.github/workflows/build_php.yml +++ b/.github/workflows/build_php.yml @@ -4,60 +4,54 @@ on: workflow_dispatch: inputs: image: - default: 'php' + default: "php" required: false type: string registry: - default: 'adeliom' + default: "adeliom" required: true type: string workflow_call: inputs: image: - default: 'php' + default: "php" required: false type: string registry: - default: 'adeliom' + default: "adeliom" required: true type: string outputs: repository: value: ${{ jobs.base-images.repository.outputs.REPOSITORY }} - + jobs: - base: + frankenphp: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - version: ["7.4", "8.0", "8.1", "8.2", "8.3"] - variant: [cli, fpm] + version: ["8.2", "8.3"] + variant: [frankenphp] steps: - uses: actions/checkout@v4 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - - name: Login to DockerHub + + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Set image tag + - name: Set image tag run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT id: image_tag - - - name: Set repository + - name: Set repository run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT id: repository - - - name: Cache Docker layers + - name: Cache Docker layers uses: actions/cache@v4 with: path: /tmp/.buildx-cache @@ -65,8 +59,7 @@ jobs: restore-keys: | ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} ${{ runner.os }}-buildx-${{ matrix.version }} - - - name: Build image amd64 + - name: Build image amd64 uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} @@ -80,93 +73,79 @@ jobs: build-args: | PHP_VERSION=${{ matrix.version }} -# - -# name: Build image arm64 -# uses: docker/build-push-action@v6 -# with: -# context: ./${{ inputs.image }} -# file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} -# platforms: "linux/arm64" -# load: true -# cache-from: type=gha -# cache-to: type=gha,mode=max -# tags: | -# ${{ steps.image_tag.outputs.IMAGE_TAG }} -# build-args: | -# PHP_VERSION=${{ matrix.version }} - - # - - # name: Run Trivy vulnerability scanner - # uses: aquasecurity/trivy-action@master - # with: - # image-ref: ${{ steps.image_tag.outputs.IMAGE_TAG }} - # ignore-unfixed: true - # vuln-type: "os,library" - # severity: "CRITICAL,HIGH" - # format: "sarif" - # output: "trivy-results.sarif" - - # - - # name: Upload Trivy scan results to GitHub Security tab - # uses: github/codeql-action/upload-sarif@v2 - # with: - # sarif_file: "trivy-results.sarif" - # category: ${{ inputs.image }}-${{ matrix.version }}-${{ matrix.variant }} - - - - name: Build and Push + frankenphp-wkhtmltopdf: + runs-on: ubuntu-latest + needs: [frankenphp] + strategy: + fail-fast: false + matrix: + version: ["8.2", "8.3"] + variant: [frankenphp-wkhtmltopdf] + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Set image tag + run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT + id: image_tag + - name: Set repository + run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT + id: repository + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} + ${{ runner.os }}-buildx-${{ matrix.version }} + - name: Build image amd64 uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} - #platforms: "linux/amd64,linux/arm64" platforms: "linux/amd64" - push: true + load: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max tags: | ${{ steps.image_tag.outputs.IMAGE_TAG }} build-args: | - PHP_VERSION=${{ matrix.version }} - - - # Temp fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache + PHP_VERSION=${{ matrix.version }} - wkhtmltopdf: + base: runs-on: ubuntu-latest - needs: [base] strategy: fail-fast: false matrix: - version: ["7.4", "8.0", "8.1", "8.2", "8.3"] - variant: [fpm-wkhtmltopdf, cli-wkhtmltopdf] + version: ["8.1", "8.2", "8.3", "8.4"] + variant: [cli, fpm] steps: - uses: actions/checkout@v4 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Login to DockerHub + + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Set image tag + - name: Set image tag run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT id: image_tag - - - name: Set repository + - name: Set repository run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT id: repository - - - name: Cache Docker layers + - name: Cache Docker layers uses: actions/cache@v4 with: path: /tmp/.buildx-cache @@ -174,8 +153,7 @@ jobs: restore-keys: | ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} ${{ runner.os }}-buildx-${{ matrix.version }} - - - name: Build image amd64 + - name: Build image amd64 uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} @@ -189,42 +167,7 @@ jobs: build-args: | PHP_VERSION=${{ matrix.version }} -# - -# name: Build image arm64 -# uses: docker/build-push-action@v6 -# with: -# context: ./${{ inputs.image }} -# file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} -# platforms: "linux/arm64" -# load: true -# cache-from: type=gha -# cache-to: type=gha,mode=max -# tags: | -# ${{ steps.image_tag.outputs.IMAGE_TAG }} -# build-args: | -# PHP_VERSION=${{ matrix.version }} - - - # - - # name: Run Trivy vulnerability scanner - # uses: aquasecurity/trivy-action@master - # with: - # image-ref: ${{ steps.image_tag.outputs.IMAGE_TAG }} - # ignore-unfixed: true - # vuln-type: "os,library" - # severity: "CRITICAL,HIGH" - # format: "sarif" - # output: "trivy-results.sarif" - - # - - # name: Upload Trivy scan results to GitHub Security tab - # uses: github/codeql-action/upload-sarif@v2 - # with: - # sarif_file: "trivy-results.sarif" - # category: ${{ inputs.image }}-${{ matrix.version }}-${{ matrix.variant }} - - - - name: Build and Push + - name: Build and Push uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} @@ -236,9 +179,7 @@ jobs: ${{ steps.image_tag.outputs.IMAGE_TAG }} build-args: | PHP_VERSION=${{ matrix.version }} - - - - # Temp fix + - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 name: Move cache @@ -246,39 +187,32 @@ jobs: rm -rf /tmp/.buildx-cache mv /tmp/.buildx-cache-new /tmp/.buildx-cache - caddy: + wkhtmltopdf: runs-on: ubuntu-latest - needs: [base, wkhtmltopdf] + needs: [base] strategy: fail-fast: false matrix: - version: ["7.4", "8.0", "8.1", "8.2", "8.3"] - variant: [caddy, caddy-wkhtmltopdf] + version: ["8.1", "8.2", "8.3", "8.4"] + variant: [fpm-wkhtmltopdf, cli-wkhtmltopdf] steps: - uses: actions/checkout@v4 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - - name: Login to DockerHub + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Set image tag + - name: Set image tag run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT id: image_tag - - - name: Set repository + - name: Set repository run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT id: repository - - - name: Cache Docker layers + - name: Cache Docker layers uses: actions/cache@v4 with: path: /tmp/.buildx-cache @@ -286,8 +220,7 @@ jobs: restore-keys: | ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} ${{ runner.os }}-buildx-${{ matrix.version }} - - - name: Build image amd64 + - name: Build image amd64 uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} @@ -300,42 +233,7 @@ jobs: ${{ steps.image_tag.outputs.IMAGE_TAG }} build-args: | PHP_VERSION=${{ matrix.version }} - -# - -# name: Build image arm64 -# uses: docker/build-push-action@v6 -# with: -# context: ./${{ inputs.image }} -# file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} -# platforms: "linux/arm64" -# load: true -# cache-from: type=gha -# cache-to: type=gha,mode=max -# tags: | -# ${{ steps.image_tag.outputs.IMAGE_TAG }} -# build-args: | -# PHP_VERSION=${{ matrix.version }} - - # - - # name: Run Trivy vulnerability scanner - # uses: aquasecurity/trivy-action@master - # with: - # image-ref: ${{ steps.image_tag.outputs.IMAGE_TAG }} - # ignore-unfixed: true - # vuln-type: "os,library" - # severity: "CRITICAL,HIGH" - # format: "sarif" - # output: "trivy-results.sarif" - - # - - # name: Upload Trivy scan results to GitHub Security tab - # uses: github/codeql-action/upload-sarif@v2 - # with: - # sarif_file: "trivy-results.sarif" - # category: ${{ inputs.image }}-${{ matrix.version }}-${{ matrix.variant }} - - - - name: Build and Push + - name: Build and Push uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} @@ -348,8 +246,7 @@ jobs: build-args: | PHP_VERSION=${{ matrix.version }} - - - # Temp fix + - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 name: Move cache @@ -357,38 +254,33 @@ jobs: rm -rf /tmp/.buildx-cache mv /tmp/.buildx-cache-new /tmp/.buildx-cache - nginx: + caddy: runs-on: ubuntu-latest needs: [base, wkhtmltopdf] strategy: fail-fast: false matrix: - version: ["7.4", "8.0", "8.1", "8.2", "8.3"] - variant: [nginx, nginx-wkhtmltopdf] + version: ["8.1", "8.2", "8.3", "8.4"] + variant: [caddy, caddy-wkhtmltopdf] steps: - uses: actions/checkout@v4 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to DockerHub + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Set image tag + - name: Set image tag run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT id: image_tag - - - name: Set repository + - name: Set repository run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT id: repository - - - name: Cache Docker layers + - name: Cache Docker layers uses: actions/cache@v4 with: path: /tmp/.buildx-cache @@ -396,8 +288,7 @@ jobs: restore-keys: | ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} ${{ runner.os }}-buildx-${{ matrix.version }} - - - name: Build image amd64 + - name: Build image amd64 uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} @@ -411,41 +302,7 @@ jobs: build-args: | PHP_VERSION=${{ matrix.version }} -# - -# name: Build image arm64 -# uses: docker/build-push-action@v6 -# with: -# context: ./${{ inputs.image }} -# file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} -# platforms: "linux/arm64" -# load: true -# cache-from: type=gha -# cache-to: type=gha,mode=max -# tags: | -# ${{ steps.image_tag.outputs.IMAGE_TAG }} -# build-args: | -# PHP_VERSION=${{ matrix.version }} - - # - - # name: Run Trivy vulnerability scanner - # uses: aquasecurity/trivy-action@master - # with: - # image-ref: ${{ steps.image_tag.outputs.IMAGE_TAG }} - # ignore-unfixed: true - # vuln-type: "os,library" - # severity: "CRITICAL,HIGH" - # format: "sarif" - # output: "trivy-results.sarif" - - # - - # name: Upload Trivy scan results to GitHub Security tab - # uses: github/codeql-action/upload-sarif@v2 - # with: - # sarif_file: "trivy-results.sarif" - # category: ${{ inputs.image }}-${{ matrix.version }}-${{ matrix.variant }} - - - - name: Build and Push + - name: Build and Push uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} @@ -458,48 +315,40 @@ jobs: build-args: | PHP_VERSION=${{ matrix.version }} - - - # Temp fix + - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 name: Move cache run: | rm -rf /tmp/.buildx-cache mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - apache: + + nginx: runs-on: ubuntu-latest needs: [base, wkhtmltopdf] strategy: fail-fast: false matrix: - version: ["7.4", "8.0", "8.1", "8.2", "8.3"] - variant: [apache, apache-wkhtmltopdf] + version: ["8.1", "8.2", "8.3", "8.4"] + variant: [nginx, nginx-wkhtmltopdf] steps: - uses: actions/checkout@v4 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - - name: Login to DockerHub + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Set image tag + - name: Set image tag run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT id: image_tag - - - name: Set repository + - name: Set repository run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT id: repository - - - name: Cache Docker layers + - name: Cache Docker layers uses: actions/cache@v4 with: path: /tmp/.buildx-cache @@ -507,8 +356,7 @@ jobs: restore-keys: | ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} ${{ runner.os }}-buildx-${{ matrix.version }} - - - name: Build image amd64 + - name: Build image amd64 uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} @@ -521,42 +369,7 @@ jobs: ${{ steps.image_tag.outputs.IMAGE_TAG }} build-args: | PHP_VERSION=${{ matrix.version }} - -# - -# name: Build image arm64 -# uses: docker/build-push-action@v6 -# with: -# context: ./${{ inputs.image }} -# file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} -# platforms: "linux/arm64" -# load: true -# cache-from: type=gha -# cache-to: type=gha,mode=max -# tags: | -# ${{ steps.image_tag.outputs.IMAGE_TAG }} -# build-args: | -# PHP_VERSION=${{ matrix.version }} - - # - - # name: Run Trivy vulnerability scanner - # uses: aquasecurity/trivy-action@master - # with: - # image-ref: ${{ steps.image_tag.outputs.IMAGE_TAG }} - # ignore-unfixed: true - # vuln-type: "os,library" - # severity: "CRITICAL,HIGH" - # format: "sarif" - # output: "trivy-results.sarif" - - # - - # name: Upload Trivy scan results to GitHub Security tab - # uses: github/codeql-action/upload-sarif@v2 - # with: - # sarif_file: "trivy-results.sarif" - # category: ${{ inputs.image }}-${{ matrix.version }}-${{ matrix.variant }} - - - - name: Build and Push + - name: Build and Push uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} @@ -568,9 +381,8 @@ jobs: ${{ steps.image_tag.outputs.IMAGE_TAG }} build-args: | PHP_VERSION=${{ matrix.version }} - - - - # Temp fix + + - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 name: Move cache @@ -578,54 +390,45 @@ jobs: rm -rf /tmp/.buildx-cache mv /tmp/.buildx-cache-new /tmp/.buildx-cache - node: + apache: runs-on: ubuntu-latest - needs: [apache, nginx, caddy] + needs: [base, wkhtmltopdf] strategy: fail-fast: false matrix: - php_version: ["7.4", "8.0", "8.1", "8.2", "8.3"] - node_version: ["16", "18", "20", "21"] - variant: [apache, apache-wkhtmltopdf, caddy, caddy-wkhtmltopdf, nginx, nginx-wkhtmltopdf] + version: ["8.1", "8.2", "8.3", "8.4"] + variant: [apache, apache-wkhtmltopdf] steps: - uses: actions/checkout@v4 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to DockerHub + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - - name: Set image tag - run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.php_version }}-${{ matrix.variant }}-node${{ matrix.node_version }}" >> $GITHUB_OUTPUT + - name: Set image tag + run: echo "IMAGE_TAG=${{ inputs.registry }}/${{ inputs.image }}:${{ matrix.version }}-${{ matrix.variant }}" >> $GITHUB_OUTPUT id: image_tag - - - name: Set repository + - name: Set repository run: echo "REPOSITORY=${{ inputs.registry }}/${{ inputs.image }}" >> $GITHUB_OUTPUT id: repository - - - name: Cache Docker layers + - name: Cache Docker layers uses: actions/cache@v4 with: path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-node${{ matrix.node_version }}-${{ github.sha }} + key: ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }}-node${{ matrix.node_version }} ${{ runner.os }}-buildx-${{ matrix.version }}-${{ matrix.variant }} ${{ runner.os }}-buildx-${{ matrix.version }} - - - name: Build image amd64 + - name: Build image amd64 uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} - file: ./${{ inputs.image }}/Dockerfile.node + file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} platforms: "linux/amd64" load: true cache-from: type=local,src=/tmp/.buildx-cache @@ -633,66 +436,24 @@ jobs: tags: | ${{ steps.image_tag.outputs.IMAGE_TAG }} build-args: | - PHP_VERSION=${{ matrix.php_version }} - IMAGE_VARIANT=${{ matrix.variant }} - NODE_VERSION=${{ matrix.node_version }} - -# - -# name: Build image arm64 -# uses: docker/build-push-action@v6 -# with: -# context: ./${{ inputs.image }} -# file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} -# platforms: "linux/arm64" -# load: true -# cache-from: type=gha -# cache-to: type=gha,mode=max -# tags: | -# ${{ steps.image_tag.outputs.IMAGE_TAG }} -# build-args: | -# PHP_VERSION=${{ matrix.version }} - - - # - - # name: Run Trivy vulnerability scanner - # uses: aquasecurity/trivy-action@master - # with: - # image-ref: ${{ steps.image_tag.outputs.IMAGE_TAG }} - # ignore-unfixed: true - # vuln-type: "os,library" - # severity: "CRITICAL,HIGH" - # format: "sarif" - # output: "trivy-results.sarif" - - # - - # name: Upload Trivy scan results to GitHub Security tab - # uses: github/codeql-action/upload-sarif@v2 - # with: - # sarif_file: "trivy-results.sarif" - # category: ${{ inputs.image }}-${{ matrix.php_version }}-${{ matrix.variant }}-node${{ matrix.node_version }} - - - - name: Build and Push + PHP_VERSION=${{ matrix.version }} + - name: Build and Push uses: docker/build-push-action@v6 with: context: ./${{ inputs.image }} - file: ./${{ inputs.image }}/Dockerfile.node + file: ./${{ inputs.image }}/Dockerfile.${{ matrix.variant }} #platforms: "linux/amd64,linux/arm64" platforms: "linux/amd64" push: true tags: | ${{ steps.image_tag.outputs.IMAGE_TAG }} build-args: | - PHP_VERSION=${{ matrix.php_version }} - IMAGE_VARIANT=${{ matrix.variant }} - NODE_VERSION=${{ matrix.node_version }} + PHP_VERSION=${{ matrix.version }} - - - # Temp fix + - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 name: Move cache run: | rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache - \ No newline at end of file + mv /tmp/.buildx-cache-new /tmp/.buildx-cache \ No newline at end of file diff --git a/Makefile b/Makefile index 558aa8f..b9576ab 100755 --- a/Makefile +++ b/Makefile @@ -44,15 +44,28 @@ endif --file $(DOCKERFILE) $(IMAGE) \ --cache-from=type=registry,ref=$(REGISTRY)$(IMAGE_NAME):$(VERSION)-$(VARIATION) +build-local: ## Build the container + $(eval DOCKERFILE := $(IMAGE)/Dockerfile-$(VERSION).$(VARIATION)) +ifeq ("$(wildcard $(DOCKERFILE))","") + $(eval DOCKERFILE := $(IMAGE)/Dockerfile.$(VARIATION)) +endif + docker buildx create --use + docker buildx build \ + --load \ + --platform linux/amd64 \ + --tag $(IMAGE_NAME):$(VERSION)-$(VARIATION) \ + --build-arg PHP_VERSION=$(VERSION) \ + --file $(DOCKERFILE) $(IMAGE) + # Run containers run: stop ## Run container - docker run -i -t --rm --name="$(IMAGE_NAME)" $(IMAGE_NAME) + @docker run -i -t --rm --name="$(IMAGE_NAME)" $(IMAGE_NAME) stop: ## Stop running containers - docker stop $(IMAGE_NAME) + @docker stop $(IMAGE_NAME) rm: stop ## Stop and remove running containers - docker rm $(IMAGE_NAME) + @docker rm $(IMAGE_NAME) # Docker release - build, tag and push the container release: build-nc publish ## Make a release by building and publishing the tagged container @@ -65,4 +78,59 @@ publish: tag ## publish the taged container # Docker tagging tag: ## Generate container tag @echo 'create tag $(VERSION)-$(VARIATION)' - docker tag $(IMAGE_NAME) $(REGISTRY)$(IMAGE_NAME):$(VERSION)-$(VARIATION) \ No newline at end of file + docker tag $(IMAGE_NAME) $(REGISTRY)$(IMAGE_NAME):$(VERSION)-$(VARIATION) + +fpm@8.4: + IMAGE=php VERSION=8.4 VARIATION=fpm $(MAKE) build-local + +caddy@8.2: + IMAGE=php VERSION=8.2 VARIATION=caddy $(MAKE) build-local + +apache@8.2: + IMAGE=php VERSION=8.2 VARIATION=apache $(MAKE) build-local + +nginx@8.2: + IMAGE=php VERSION=8.2 VARIATION=nginx $(MAKE) build-local + +frankenphp@8.2: + IMAGE=php VERSION=8.2 VARIATION=frankenphp $(MAKE) build-local + +caddy@8.2-debug: + $(eval IMAGE := php) + $(eval VERSION := 8.2) + $(eval VARIATION := caddy) + $(eval IMAGE_NAME := $(IMAGE_PREFIX)/$(IMAGE):$(VERSION)-$(VARIATION)) + @docker stop $(IMAGE)_$(VERSION)-$(VARIATION) || true + @docker run -i -t --rm -p 1234:80 -v ./test/:/var/www/html/ --name="$(IMAGE)_$(VERSION)-$(VARIATION)" $(IMAGE_NAME) + +apache@8.2-debug: + $(eval IMAGE := php) + $(eval VERSION := 8.2) + $(eval VARIATION := apache) + $(eval IMAGE_NAME := $(IMAGE_PREFIX)/$(IMAGE):$(VERSION)-$(VARIATION)) + @docker stop $(IMAGE)_$(VERSION)-$(VARIATION) || true + @docker run -i -t --rm -p 1234:80 -v ./test/:/var/www/html/ --name="$(IMAGE)_$(VERSION)-$(VARIATION)" $(IMAGE_NAME) + +nginx@8.2-debug: + $(eval IMAGE := php) + $(eval VERSION := 8.2) + $(eval VARIATION := nginx) + $(eval IMAGE_NAME := $(IMAGE_PREFIX)/$(IMAGE):$(VERSION)-$(VARIATION)) + @docker stop $(IMAGE)_$(VERSION)-$(VARIATION) || true + @docker run -i -t --rm -p 1234:80 -v ./test/:/var/www/html/ --name="$(IMAGE)_$(VERSION)-$(VARIATION)" $(IMAGE_NAME) + +frankenphp@8.2-debug: + $(eval IMAGE := php) + $(eval VERSION := 8.2) + $(eval VARIATION := frankenphp) + $(eval IMAGE_NAME := $(IMAGE_PREFIX)/$(IMAGE):$(VERSION)-$(VARIATION)) + @docker stop $(IMAGE)_$(VERSION)-$(VARIATION) || true + @docker run -i -t --rm -p 1234:80 -v ./test/:/var/www/html/ --name="$(IMAGE)_$(VERSION)-$(VARIATION)" $(IMAGE_NAME) + +frankenphp@8.2-worker-debug: + $(eval IMAGE := php) + $(eval VERSION := 8.2) + $(eval VARIATION := frankenphp) + $(eval IMAGE_NAME := $(IMAGE_PREFIX)/$(IMAGE):$(VERSION)-$(VARIATION)) + @docker stop $(IMAGE)_$(VERSION)-$(VARIATION) || true + @docker run -i -t --rm -p 1234:80 -v ./test/:/var/www/html/ -e FRANKENPHP_CONFIG="worker /var/www/html/index.php" -e FRANKENPHP_WORKER=true --name="$(IMAGE)_$(VERSION)-$(VARIATION)" $(IMAGE_NAME) diff --git a/php/Dockerfile.caddy b/php/Dockerfile.caddy index b9cc362..53fbbd2 100755 --- a/php/Dockerfile.caddy +++ b/php/Dockerfile.caddy @@ -15,19 +15,23 @@ RUN set -eux; \ COPY --from=caddy-builder /usr/bin/caddy /usr/bin/caddy -RUN apk --update add --no-cache supervisor \ - ca-certificates \ - mailcap \ +RUN set -x \ + && apk --update add --no-cache supervisor \ + ca-certificates \ + mailcap \ + nss-tools \ && rm -rf /tmp/* /var/cache/apk/* ENV XDG_CONFIG_HOME="/config" ENV XDG_DATA_HOME="/data" +ENV SERVER_NAME=":80" ENV DOCUMENT_ROOT="/var/www/html/" EXPOSE 80 +EXPOSE 443 +EXPOSE 443/udp EXPOSE 2019 -EXPOSE 2021 WORKDIR /var/www/html/ VOLUME ["/etc/caddy", "/config/caddy", "/data/caddy", "/var/www/html"] diff --git a/php/Dockerfile.caddy-wkhtmltopdf b/php/Dockerfile.caddy-wkhtmltopdf index 1440473..5e4a728 100755 --- a/php/Dockerfile.caddy-wkhtmltopdf +++ b/php/Dockerfile.caddy-wkhtmltopdf @@ -15,19 +15,23 @@ RUN set -eux; \ COPY --from=caddy-builder /usr/bin/caddy /usr/bin/caddy -RUN apk --update add --no-cache supervisor \ - ca-certificates \ - mailcap \ +RUN set -x \ + && apk --update add --no-cache supervisor \ + ca-certificates \ + mailcap \ + nss-tools \ && rm -rf /tmp/* /var/cache/apk/* ENV XDG_CONFIG_HOME="/config" ENV XDG_DATA_HOME="/data" +ENV SERVER_NAME=":80" ENV DOCUMENT_ROOT="/var/www/html/" EXPOSE 80 +EXPOSE 443 +EXPOSE 443/udp EXPOSE 2019 -EXPOSE 2021 WORKDIR /var/www/html/ VOLUME ["/etc/caddy", "/config/caddy", "/data/caddy", "/var/www/html"] diff --git a/php/Dockerfile.fpm b/php/Dockerfile.fpm index 2033553..dc376d4 100755 --- a/php/Dockerfile.fpm +++ b/php/Dockerfile.fpm @@ -44,7 +44,7 @@ ENV XDEBUG_MODE='off' WORKDIR /var/www/html -RUN apk add --upgrade --no-cache \ +RUN apk add --upgrade --no-cache \ acl \ bash \ rsync \ @@ -60,7 +60,7 @@ RUN apk add --upgrade --no-cache \ openssl \ zip \ unzip \ - ; + && rm -rf /tmp/* /var/cache/apk/* # persistent / runtime deps ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ @@ -76,7 +76,8 @@ COPY config/fpm/pool.d /usr/local/etc/pool.d RUN echo "expose_php = Off" > /usr/local/etc/php/conf.d/expose_php.ini # Install extensions -RUN install-php-extensions opcache sysvsem soap intl gettext ldap swoole zip amqp redis mysqli pgsql pdo_mysql pdo_pgsql gd exif xdebug +RUN install-php-extensions opcache intl gettext zip redis mysqli pgsql pdo_mysql pdo_pgsql gd exif xdebug +RUN install-php-extensions sysvsem soap ldap amqp COPY --from=composer /usr/bin/composer /usr/bin/composer diff --git a/php/Dockerfile.frankenphp b/php/Dockerfile.frankenphp new file mode 100755 index 0000000..23f8ff7 --- /dev/null +++ b/php/Dockerfile.frankenphp @@ -0,0 +1,94 @@ +# syntax=docker/dockerfile:1 +ARG PHP_VERSION +FROM dunglas/frankenphp:php${PHP_VERSION} + +ENV COMPOSER_ALLOW_SUPERUSER='1' +ENV COMPOSER_MEMORY_LIMIT='-1' +ENV PHP_INI_MEMORY_LIMIT='-1' + +ENV PHP_INI_DATE_TIMEZONE='UTC' +ENV PHP_INI_CGI_FIX_PATHINFO='0' + +ENV PHP_INI_UPLOAD_MAX_FILESIZE='16M' +ENV PHP_INI_POST_MAX_SIZE='16M' + +ENV PHP_INI_ERROR_REPORTING='E_ALL & ~E_DEPRECATED & ~E_STRICT' +ENV PHP_INI_DISPLAY_ERRORS='Off' +ENV PHP_INI_DISPLAY_STARTUP_ERRORS='Off' + +ENV PHP_INI_REALPATH_CACHE_SIZE='4096k' +ENV PHP_INI_REALPATH_CACHE_TTL='120' + +ENV PHP_INI_OPCACHE_MEMORY_CONSUMPTION='128' +ENV PHP_INI_OPCACHE_INTERNED_STRINGS_BUFFER='8' +ENV PHP_INI_OPCACHE_MAX_ACCELERATED_FILES='4000' +ENV PHP_INI_OPCACHE_REVALIDATE_FREQ='60' +ENV PHP_INI_OPCACHE_VALIDATE_TIMESTAMPS='1' +ENV PHP_INI_OPCACHE_FAST_SHUTDOWN='1' +ENV PHP_INI_OPCACHE_ENABLE_CLI='1' +ENV PHP_INI_OPCACHE_ENABLE='1' +ENV PHP_INI_OPCACHE_PRELOAD='' +ENV PHP_INI_OPCACHE_PRELOAD_USER='' + +ENV PHP_INI_SOAP_WSDL_CACHE_ENABLED='1' + +ENV PHP_INI_MAX_EXECUTION_TIME='30' +ENV PHP_INI_MAX_INPUT_TIME='60' + +ENV PHP_INI_SENDMAIL_PATH='sendmail -t -i' + +ENV XDEBUG_REMOTE_AUTOSTART='1' +ENV XDEBUG_REMOTE_PORT='9003' +ENV XDEBUG_START_WITH_REQUEST='trigger' +ENV XDEBUG_MODE='off' + +RUN set -x \ + && apt-get update && apt-get install -y supervisor \ + ca-certificates \ + mime-support \ + libnss3-tools \ + imagemagick \ + jpegoptim \ + optipng \ + webp \ + pngquant \ + ffmpeg \ + libavif-dev \ + mysql-client \ + postgresql-client \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +ENV XDG_CONFIG_HOME="/config" +ENV XDG_DATA_HOME="/data" + +ENV SERVER_NAME=":80" +ENV DOCUMENT_ROOT="/var/www/html/" + +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ +RUN chmod +x /usr/local/bin/install-php-extensions + +WORKDIR /var/www/html + +EXPOSE 80 +EXPOSE 443 +EXPOSE 443/udp +EXPOSE 2019 + +# Use the default production configuration +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +COPY config/php.ini /usr/local/etc/php/conf.d/000-php.ini + +RUN echo "expose_php = Off" > /usr/local/etc/php/conf.d/expose_php.ini + +# Install extensions +RUN set -x \ + install-php-extensions opcache intl gettext zip redis mysqli pgsql pdo_mysql pdo_pgsql gd exif xdebug pcntl + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +COPY config/frankenphp/Caddyfile /etc/caddy/ + +STOPSIGNAL SIGQUIT + +CMD ["--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] \ No newline at end of file diff --git a/php/Dockerfile.frankenphp-wkhtmltopdf b/php/Dockerfile.frankenphp-wkhtmltopdf new file mode 100755 index 0000000..f2bb7fc --- /dev/null +++ b/php/Dockerfile.frankenphp-wkhtmltopdf @@ -0,0 +1,93 @@ +# syntax=docker/dockerfile:1 +ARG PHP_VERSION +FROM dunglas/frankenphp:php${PHP_VERSION} + +ENV COMPOSER_ALLOW_SUPERUSER='1' +ENV COMPOSER_MEMORY_LIMIT='-1' +ENV PHP_INI_MEMORY_LIMIT='-1' + +ENV PHP_INI_DATE_TIMEZONE='UTC' +ENV PHP_INI_CGI_FIX_PATHINFO='0' + +ENV PHP_INI_UPLOAD_MAX_FILESIZE='16M' +ENV PHP_INI_POST_MAX_SIZE='16M' + +ENV PHP_INI_ERROR_REPORTING='E_ALL & ~E_DEPRECATED & ~E_STRICT' +ENV PHP_INI_DISPLAY_ERRORS='Off' +ENV PHP_INI_DISPLAY_STARTUP_ERRORS='Off' + +ENV PHP_INI_REALPATH_CACHE_SIZE='4096k' +ENV PHP_INI_REALPATH_CACHE_TTL='120' + +ENV PHP_INI_OPCACHE_MEMORY_CONSUMPTION='128' +ENV PHP_INI_OPCACHE_INTERNED_STRINGS_BUFFER='8' +ENV PHP_INI_OPCACHE_MAX_ACCELERATED_FILES='4000' +ENV PHP_INI_OPCACHE_REVALIDATE_FREQ='60' +ENV PHP_INI_OPCACHE_VALIDATE_TIMESTAMPS='1' +ENV PHP_INI_OPCACHE_FAST_SHUTDOWN='1' +ENV PHP_INI_OPCACHE_ENABLE_CLI='1' +ENV PHP_INI_OPCACHE_ENABLE='1' +ENV PHP_INI_OPCACHE_PRELOAD='' +ENV PHP_INI_OPCACHE_PRELOAD_USER='' + +ENV PHP_INI_SOAP_WSDL_CACHE_ENABLED='1' + +ENV PHP_INI_MAX_EXECUTION_TIME='30' +ENV PHP_INI_MAX_INPUT_TIME='60' + +ENV PHP_INI_SENDMAIL_PATH='sendmail -t -i' + +ENV XDEBUG_REMOTE_AUTOSTART='1' +ENV XDEBUG_REMOTE_PORT='9003' +ENV XDEBUG_START_WITH_REQUEST='trigger' +ENV XDEBUG_MODE='off' + +RUN set -x \ + && apt-get update && apt-get install -y supervisor \ + ca-certificates \ + mime-support \ + libnss3-tools \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +ENV XDG_CONFIG_HOME="/config" +ENV XDG_DATA_HOME="/data" + +ENV SERVER_NAME=":80" +ENV DOCUMENT_ROOT="/var/www/html/" + +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ +RUN chmod +x /usr/local/bin/install-php-extensions + +WORKDIR /var/www/html + +EXPOSE 80 +EXPOSE 443 +EXPOSE 443/udp +EXPOSE 2019 + +# Use the default production configuration +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +COPY config/php.ini /usr/local/etc/php/conf.d/000-php.ini + +RUN echo "expose_php = Off" > /usr/local/etc/php/conf.d/expose_php.ini + +# Install extensions +RUN set -x \ + install-php-extensions opcache intl gettext zip redis mysqli pgsql pdo_mysql pdo_pgsql gd exif xdebug pcntl + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +COPY config/frankenphp/Caddyfile /etc/caddy/ + +RUN set -x \ + && apt-get update \ + && apt-get install -y \ + wkhtmltopdf \ + imagemagick \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +STOPSIGNAL SIGQUIT + +CMD ["--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] diff --git a/php/Dockerfile.nginx b/php/Dockerfile.nginx index 18c4e68..5aaaee2 100755 --- a/php/Dockerfile.nginx +++ b/php/Dockerfile.nginx @@ -2,194 +2,29 @@ ARG PHP_VERSION FROM adeliom/php:${PHP_VERSION}-fpm -ENV NGINX_VERSION="1.27.1" -ENV PKG_RELEASE="1" -ENV NJS_VERSION="0.8.5" +RUN apk --update add --no-cache \ + supervisor \ + mailcap \ + nginx \ + && rm -rf /tmp/* /var/cache/apk/* RUN set -x \ -# create nginx user/group first, to be consistent throughout docker variants - && addgroup -g 101 -S nginx \ - && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \ - && apkArch="$(cat /etc/apk/arch)" \ - && nginxPackages=" \ - nginx=${NGINX_VERSION}-r${PKG_RELEASE} \ - " \ -# install prerequisites for public key and pkg-oss checks - && apk add --no-cache --virtual .checksum-deps \ - openssl \ - && case "$apkArch" in \ - x86_64|aarch64) \ -# arches officially built by upstream - set -x \ - && KEY_SHA512="e09fa32f0a0eab2b879ccbbc4d0e4fb9751486eedda75e35fac65802cc9faa266425edf83e261137a2f4d16281ce2c1a5f4502930fe75154723da014214f0655" \ - && wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub \ - && if echo "$KEY_SHA512 */tmp/nginx_signing.rsa.pub" | sha512sum -c -; then \ - echo "key verification succeeded!"; \ - mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; \ - else \ - echo "key verification failed!"; \ - exit 1; \ - fi \ - && apk add -X "https://nginx.org/packages/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" --no-cache $nginxPackages \ - ;; \ - *) \ -# we're on an architecture upstream doesn't officially build for -# let's build binaries from the published packaging sources - set -x \ - && tempDir="$(mktemp -d)" \ - && chown nobody:nobody $tempDir \ - && apk add --no-cache --virtual .build-deps \ - gcc \ - libc-dev \ - make \ - openssl-dev \ - pcre2-dev \ - zlib-dev \ - linux-headers \ - bash \ - alpine-sdk \ - findutils \ - && su nobody -s /bin/sh -c " \ - export HOME=${tempDir} \ - && cd ${tempDir} \ - && curl -f -O https://hg.nginx.org/pkg-oss/archive/e5d85b3424bb.tar.gz \ - && PKGOSSCHECKSUM=\"4f33347bf05e7d7dd42a52b6e7af7ec21e3ed71df05a8ec16dd1228425f04e4318d88b1340370ccb6ad02cde590fc102094ddffbb1fc86d2085295a43f02f67b *e5d85b3424bb.tar.gz\" \ - && if [ \"\$(openssl sha512 -r e5d85b3424bb.tar.gz)\" = \"\$PKGOSSCHECKSUM\" ]; then \ - echo \"pkg-oss tarball checksum verification succeeded!\"; \ - else \ - echo \"pkg-oss tarball checksum verification failed!\"; \ - exit 1; \ - fi \ - && tar xzvf e5d85b3424bb.tar.gz \ - && cd pkg-oss-e5d85b3424bb \ - && cd alpine \ - && make base \ - && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \ - && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \ - " \ - && cp ${tempDir}/.abuild/abuild-key.rsa.pub /etc/apk/keys/ \ - && apk del --no-network .build-deps \ - && apk add -X ${tempDir}/packages/alpine/ --no-cache $nginxPackages \ - ;; \ - esac \ -# remove checksum deps - && apk del --no-network .checksum-deps \ -# if we have leftovers from building, let's purge them (including extra, unnecessary build deps) - && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \ - && if [ -f "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \ - && if [ -f "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \ -# Bring in gettext so we can get `envsubst`, then throw -# the rest away. To do this, we need to install `gettext` -# then move `envsubst` out of the way so `gettext` can -# be deleted completely, then move `envsubst` back. && apk add --no-cache --virtual .gettext gettext \ && mv /usr/bin/envsubst /tmp/ \ - \ - && runDeps="$( \ - scanelf --needed --nobanner /tmp/envsubst \ - | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ - | sort -u \ - | xargs -r apk info --installed \ - | sort -u \ - )" \ - && apk add --no-cache $runDeps \ - && apk del --no-network .gettext \ + && apk del .gettext \ && mv /tmp/envsubst /usr/local/bin/ \ -# Bring in tzdata so users could set the timezones through the environment -# variables && apk add --no-cache tzdata \ -# forward request and error logs to docker log collector + # forward request and error logs to docker log collector && ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log \ -# create a docker-entrypoint.d directory + # create a docker-entrypoint.d directory && mkdir /docker-entrypoint.d -RUN set -x \ - && apkArch="$(cat /etc/apk/arch)" \ - && nginxPackages=" \ - nginx=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-xslt=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-geoip=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-image-filter=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-r${PKG_RELEASE} \ - " \ -# install prerequisites for public key and pkg-oss checks - && apk add --no-cache --virtual .checksum-deps \ - openssl \ - && case "$apkArch" in \ - x86_64|aarch64) \ -# arches officially built by upstream - set -x \ - && KEY_SHA512="e09fa32f0a0eab2b879ccbbc4d0e4fb9751486eedda75e35fac65802cc9faa266425edf83e261137a2f4d16281ce2c1a5f4502930fe75154723da014214f0655" \ - && wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub \ - && if echo "$KEY_SHA512 */tmp/nginx_signing.rsa.pub" | sha512sum -c -; then \ - echo "key verification succeeded!"; \ - mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; \ - else \ - echo "key verification failed!"; \ - exit 1; \ - fi \ - && apk add -X "https://nginx.org/packages/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" --no-cache $nginxPackages \ - ;; \ - *) \ -# we're on an architecture upstream doesn't officially build for -# let's build binaries from the published packaging sources - set -x \ - && tempDir="$(mktemp -d)" \ - && chown nobody:nobody $tempDir \ - && apk add --no-cache --virtual .build-deps \ - gcc \ - libc-dev \ - make \ - openssl-dev \ - pcre2-dev \ - zlib-dev \ - linux-headers \ - libxslt-dev \ - gd-dev \ - geoip-dev \ - libedit-dev \ - bash \ - alpine-sdk \ - findutils \ - && su nobody -s /bin/sh -c " \ - export HOME=${tempDir} \ - && cd ${tempDir} \ - && curl -f -O https://hg.nginx.org/pkg-oss/archive/e5d85b3424bb.tar.gz \ - && PKGOSSCHECKSUM=\"4f33347bf05e7d7dd42a52b6e7af7ec21e3ed71df05a8ec16dd1228425f04e4318d88b1340370ccb6ad02cde590fc102094ddffbb1fc86d2085295a43f02f67b *e5d85b3424bb.tar.gz\" \ - && if [ \"\$(openssl sha512 -r e5d85b3424bb.tar.gz)\" = \"\$PKGOSSCHECKSUM\" ]; then \ - echo \"pkg-oss tarball checksum verification succeeded!\"; \ - else \ - echo \"pkg-oss tarball checksum verification failed!\"; \ - exit 1; \ - fi \ - && tar xzvf e5d85b3424bb.tar.gz \ - && cd pkg-oss-e5d85b3424bb \ - && cd alpine \ - && make module-geoip module-image-filter module-njs module-xslt \ - && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \ - && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \ - " \ - && cp ${tempDir}/.abuild/abuild-key.rsa.pub /etc/apk/keys/ \ - && apk del --no-network .build-deps \ - && apk add -X ${tempDir}/packages/alpine/ --no-cache $nginxPackages \ - ;; \ - esac \ -# remove checksum deps - && apk del --no-network .checksum-deps \ -# if we have leftovers from building, let's purge them (including extra, unnecessary build deps) - && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \ - && if [ -f "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \ - && if [ -f "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \ -# Bring in curl and ca-certificates to make registering on DNS SD easier - && apk add --no-cache curl ca-certificates - -RUN apk --update add --no-cache supervisor \ - mailcap \ - && rm -rf /tmp/* /var/cache/apk/* - ENV DOCUMENT_ROOT="/var/www/html/" + EXPOSE 80 +EXPOSE 443 +EXPOSE 443/udp WORKDIR /var/www/html/ VOLUME ["/var/www/html"] @@ -208,7 +43,7 @@ RUN chmod +x /docker-entrypoint.d/* COPY config/nginx/nginx.conf /etc/nginx/ COPY config/nginx/default.conf.template /etc/nginx/templates/ -RUN mkdir -p /var/tmp/nginx && chmod -R 777 /var/tmp/nginx +RUN mkdir -p /tmp/nginx/conf.d && chmod -R 777 /tmp/nginx COPY config/nginx/docker-entrypoint.sh /usr/local/bin/docker-entrypoint RUN chmod +x /usr/local/bin/docker-entrypoint diff --git a/php/Dockerfile.nginx-wkhtmltopdf b/php/Dockerfile.nginx-wkhtmltopdf index 7a2aea0..eaf2706 100755 --- a/php/Dockerfile.nginx-wkhtmltopdf +++ b/php/Dockerfile.nginx-wkhtmltopdf @@ -2,194 +2,29 @@ ARG PHP_VERSION FROM adeliom/php:${PHP_VERSION}-fpm-wkhtmltopdf -ENV NGINX_VERSION="1.27.1" -ENV PKG_RELEASE="1" -ENV NJS_VERSION="0.8.5" +RUN apk --update add --no-cache \ + supervisor \ + mailcap \ + nginx \ + && rm -rf /tmp/* /var/cache/apk/* RUN set -x \ -# create nginx user/group first, to be consistent throughout docker variants - && addgroup -g 101 -S nginx \ - && adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \ - && apkArch="$(cat /etc/apk/arch)" \ - && nginxPackages=" \ - nginx=${NGINX_VERSION}-r${PKG_RELEASE} \ - " \ -# install prerequisites for public key and pkg-oss checks - && apk add --no-cache --virtual .checksum-deps \ - openssl \ - && case "$apkArch" in \ - x86_64|aarch64) \ -# arches officially built by upstream - set -x \ - && KEY_SHA512="e09fa32f0a0eab2b879ccbbc4d0e4fb9751486eedda75e35fac65802cc9faa266425edf83e261137a2f4d16281ce2c1a5f4502930fe75154723da014214f0655" \ - && wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub \ - && if echo "$KEY_SHA512 */tmp/nginx_signing.rsa.pub" | sha512sum -c -; then \ - echo "key verification succeeded!"; \ - mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; \ - else \ - echo "key verification failed!"; \ - exit 1; \ - fi \ - && apk add -X "https://nginx.org/packages/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" --no-cache $nginxPackages \ - ;; \ - *) \ -# we're on an architecture upstream doesn't officially build for -# let's build binaries from the published packaging sources - set -x \ - && tempDir="$(mktemp -d)" \ - && chown nobody:nobody $tempDir \ - && apk add --no-cache --virtual .build-deps \ - gcc \ - libc-dev \ - make \ - openssl-dev \ - pcre2-dev \ - zlib-dev \ - linux-headers \ - bash \ - alpine-sdk \ - findutils \ - && su nobody -s /bin/sh -c " \ - export HOME=${tempDir} \ - && cd ${tempDir} \ - && curl -f -O https://hg.nginx.org/pkg-oss/archive/e5d85b3424bb.tar.gz \ - && PKGOSSCHECKSUM=\"4f33347bf05e7d7dd42a52b6e7af7ec21e3ed71df05a8ec16dd1228425f04e4318d88b1340370ccb6ad02cde590fc102094ddffbb1fc86d2085295a43f02f67b *e5d85b3424bb.tar.gz\" \ - && if [ \"\$(openssl sha512 -r e5d85b3424bb.tar.gz)\" = \"\$PKGOSSCHECKSUM\" ]; then \ - echo \"pkg-oss tarball checksum verification succeeded!\"; \ - else \ - echo \"pkg-oss tarball checksum verification failed!\"; \ - exit 1; \ - fi \ - && tar xzvf e5d85b3424bb.tar.gz \ - && cd pkg-oss-e5d85b3424bb \ - && cd alpine \ - && make base \ - && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \ - && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \ - " \ - && cp ${tempDir}/.abuild/abuild-key.rsa.pub /etc/apk/keys/ \ - && apk del --no-network .build-deps \ - && apk add -X ${tempDir}/packages/alpine/ --no-cache $nginxPackages \ - ;; \ - esac \ -# remove checksum deps - && apk del --no-network .checksum-deps \ -# if we have leftovers from building, let's purge them (including extra, unnecessary build deps) - && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \ - && if [ -f "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \ - && if [ -f "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \ -# Bring in gettext so we can get `envsubst`, then throw -# the rest away. To do this, we need to install `gettext` -# then move `envsubst` out of the way so `gettext` can -# be deleted completely, then move `envsubst` back. && apk add --no-cache --virtual .gettext gettext \ && mv /usr/bin/envsubst /tmp/ \ - \ - && runDeps="$( \ - scanelf --needed --nobanner /tmp/envsubst \ - | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ - | sort -u \ - | xargs -r apk info --installed \ - | sort -u \ - )" \ - && apk add --no-cache $runDeps \ - && apk del --no-network .gettext \ + && apk del .gettext \ && mv /tmp/envsubst /usr/local/bin/ \ -# Bring in tzdata so users could set the timezones through the environment -# variables && apk add --no-cache tzdata \ -# forward request and error logs to docker log collector + # forward request and error logs to docker log collector && ln -sf /dev/stdout /var/log/nginx/access.log \ && ln -sf /dev/stderr /var/log/nginx/error.log \ -# create a docker-entrypoint.d directory + # create a docker-entrypoint.d directory && mkdir /docker-entrypoint.d -RUN set -x \ - && apkArch="$(cat /etc/apk/arch)" \ - && nginxPackages=" \ - nginx=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-xslt=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-geoip=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-image-filter=${NGINX_VERSION}-r${PKG_RELEASE} \ - nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-r${PKG_RELEASE} \ - " \ -# install prerequisites for public key and pkg-oss checks - && apk add --no-cache --virtual .checksum-deps \ - openssl \ - && case "$apkArch" in \ - x86_64|aarch64) \ -# arches officially built by upstream - set -x \ - && KEY_SHA512="e09fa32f0a0eab2b879ccbbc4d0e4fb9751486eedda75e35fac65802cc9faa266425edf83e261137a2f4d16281ce2c1a5f4502930fe75154723da014214f0655" \ - && wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub \ - && if echo "$KEY_SHA512 */tmp/nginx_signing.rsa.pub" | sha512sum -c -; then \ - echo "key verification succeeded!"; \ - mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; \ - else \ - echo "key verification failed!"; \ - exit 1; \ - fi \ - && apk add -X "https://nginx.org/packages/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" --no-cache $nginxPackages \ - ;; \ - *) \ -# we're on an architecture upstream doesn't officially build for -# let's build binaries from the published packaging sources - set -x \ - && tempDir="$(mktemp -d)" \ - && chown nobody:nobody $tempDir \ - && apk add --no-cache --virtual .build-deps \ - gcc \ - libc-dev \ - make \ - openssl-dev \ - pcre2-dev \ - zlib-dev \ - linux-headers \ - libxslt-dev \ - gd-dev \ - geoip-dev \ - libedit-dev \ - bash \ - alpine-sdk \ - findutils \ - && su nobody -s /bin/sh -c " \ - export HOME=${tempDir} \ - && cd ${tempDir} \ - && curl -f -O https://hg.nginx.org/pkg-oss/archive/e5d85b3424bb.tar.gz \ - && PKGOSSCHECKSUM=\"4f33347bf05e7d7dd42a52b6e7af7ec21e3ed71df05a8ec16dd1228425f04e4318d88b1340370ccb6ad02cde590fc102094ddffbb1fc86d2085295a43f02f67b *e5d85b3424bb.tar.gz\" \ - && if [ \"\$(openssl sha512 -r e5d85b3424bb.tar.gz)\" = \"\$PKGOSSCHECKSUM\" ]; then \ - echo \"pkg-oss tarball checksum verification succeeded!\"; \ - else \ - echo \"pkg-oss tarball checksum verification failed!\"; \ - exit 1; \ - fi \ - && tar xzvf e5d85b3424bb.tar.gz \ - && cd pkg-oss-e5d85b3424bb \ - && cd alpine \ - && make module-geoip module-image-filter module-njs module-xslt \ - && apk index -o ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz ${tempDir}/packages/alpine/${apkArch}/*.apk \ - && abuild-sign -k ${tempDir}/.abuild/abuild-key.rsa ${tempDir}/packages/alpine/${apkArch}/APKINDEX.tar.gz \ - " \ - && cp ${tempDir}/.abuild/abuild-key.rsa.pub /etc/apk/keys/ \ - && apk del --no-network .build-deps \ - && apk add -X ${tempDir}/packages/alpine/ --no-cache $nginxPackages \ - ;; \ - esac \ -# remove checksum deps - && apk del --no-network .checksum-deps \ -# if we have leftovers from building, let's purge them (including extra, unnecessary build deps) - && if [ -n "$tempDir" ]; then rm -rf "$tempDir"; fi \ - && if [ -f "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \ - && if [ -f "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \ -# Bring in curl and ca-certificates to make registering on DNS SD easier - && apk add --no-cache curl ca-certificates - -RUN apk --update add --no-cache supervisor \ - mailcap \ - && rm -rf /tmp/* /var/cache/apk/* - ENV DOCUMENT_ROOT="/var/www/html/" + EXPOSE 80 +EXPOSE 443 +EXPOSE 443/udp WORKDIR /var/www/html/ VOLUME ["/var/www/html"] @@ -208,7 +43,7 @@ RUN chmod +x /docker-entrypoint.d/* COPY config/nginx/nginx.conf /etc/nginx/ COPY config/nginx/default.conf.template /etc/nginx/templates/ -RUN mkdir -p /var/tmp/nginx && chmod -R 777 /var/tmp/nginx +RUN mkdir -p /tmp/nginx/conf.d && chmod -R 777 /tmp/nginx COPY config/nginx/docker-entrypoint.sh /usr/local/bin/docker-entrypoint RUN chmod +x /usr/local/bin/docker-entrypoint diff --git a/php/Dockerfile.node b/php/Dockerfile.node deleted file mode 100755 index 2f8c222..0000000 --- a/php/Dockerfile.node +++ /dev/null @@ -1,14 +0,0 @@ -# syntax=docker/dockerfile:1 -ARG PHP_VERSION -ARG IMAGE_VARIANT -ARG NODE_VERSION - -FROM node:${NODE_VERSION}-alpine AS node -FROM adeliom/php:${PHP_VERSION}-${IMAGE_VARIANT} - -COPY --from=node /usr/lib /usr/lib -COPY --from=node /usr/local/share /usr/local/share -COPY --from=node /usr/local/lib /usr/local/lib -COPY --from=node /usr/local/include /usr/local/include -COPY --from=node /usr/local/bin /usr/local/bin -COPY --from=node /opt /opt \ No newline at end of file diff --git a/php/README.md b/php/README.md index 7e7eeec..4ebaaf7 100644 --- a/php/README.md +++ b/php/README.md @@ -1,176 +1,63 @@ # Adeliom PHP + ![Docker Pulls](https://img.shields.io/docker/pulls/adeliom/php) This repository contains a set of developer-friendly, general purpose PHP images for Docker. -* You can also modify the php.ini settings using environment variables. -* 2 runtime variants available: cli, fpm -* 3 server variants available: apache, nginx and caddy -* A variant with wkhtmltopdf -* Images come with Composer -* All server variants can be installed with or without NodeJS (if you need to build your static assets). +- You can also modify the php.ini settings using environment variables. +- 2 runtime variants available: cli, fpm +- 4 server variants available: apache, nginx, caddy and frankenphp +- A variant with wkhtmltopdf +- Images come with Composer ## Images -| Name | PHP version | NodeJS version | variant | server | wkhtmltopdf | -|------|-------------|----------------|---------|--------|:-------------:| -|`adeliom/php:7.4-cli`|`7.4`||`cli`||| -|`adeliom/php:8.0-cli`|`8.0`||`cli`||| -|`adeliom/php:8.1-cli`|`8.1`||`cli`||| -|`adeliom/php:8.2-cli`|`8.2`||`cli`||| -|`adeliom/php:8.3-cli`|`8.3`||`cli`||| -|`adeliom/php:7.4-cli-wkhtmltopdf`|`7.4`||`cli`||✅| -|`adeliom/php:8.0-cli-wkhtmltopdf`|`8.0`||`cli`||✅| -|`adeliom/php:8.1-cli-wkhtmltopdf`|`8.1`||`cli`||✅| -|`adeliom/php:8.2-cli-wkhtmltopdf`|`8.2`||`cli`||✅| -|`adeliom/php:8.3-cli-wkhtmltopdf`|`8.3`||`cli`||✅| -|`adeliom/php:7.4-fpm`|`7.4`||`fpm`||| -|`adeliom/php:8.0-fpm`|`8.0`||`fpm`||| -|`adeliom/php:8.1-fpm`|`8.1`||`fpm`||| -|`adeliom/php:8.2-fpm`|`8.2`||`fpm`||| -|`adeliom/php:8.3-fpm`|`8.3`||`fpm`||| -|`adeliom/php:7.4-fpm-wkhtmltopdf`|`7.4`||`fpm`||✅| -|`adeliom/php:8.0-fpm-wkhtmltopdf`|`8.0`||`fpm`||✅| -|`adeliom/php:8.1-fpm-wkhtmltopdf`|`8.1`||`fpm`||✅| -|`adeliom/php:8.2-fpm-wkhtmltopdf`|`8.2`||`fpm`||✅| -|`adeliom/php:8.3-fpm-wkhtmltopdf`|`8.3`||`fpm`||✅| -|`adeliom/php:7.4-apache`|`7.4`||`fpm`|`apache`|| -|`adeliom/php:8.0-apache`|`8.0`||`fpm`|`apache`|| -|`adeliom/php:8.1-apache`|`8.1`||`fpm`|`apache`|| -|`adeliom/php:8.2-apache`|`8.2`||`fpm`|`apache`|| -|`adeliom/php:8.3-apache`|`8.3`||`fpm`|`apache`|| -|`adeliom/php:7.4-apache-node16`|`7.4`|`16`|`fpm`|`apache`|| -|`adeliom/php:8.0-apache-node16`|`8.0`|`16`|`fpm`|`apache`|| -|`adeliom/php:8.1-apache-node16`|`8.1`|`16`|`fpm`|`apache`|| -|`adeliom/php:8.2-apache-node16`|`8.2`|`16`|`fpm`|`apache`|| -|`adeliom/php:8.3-apache-node16`|`8.3`|`16`|`fpm`|`apache`|| -|`adeliom/php:7.4-apache-node18`|`7.4`|`18`|`fpm`|`apache`|| -|`adeliom/php:8.0-apache-node18`|`8.0`|`18`|`fpm`|`apache`|| -|`adeliom/php:8.1-apache-node18`|`8.1`|`18`|`fpm`|`apache`|| -|`adeliom/php:8.2-apache-node18`|`8.2`|`18`|`fpm`|`apache`|| -|`adeliom/php:8.3-apache-node18`|`8.3`|`18`|`fpm`|`apache`|| -|`adeliom/php:7.4-apache-wkhtmltopdf`|`7.4`||`fpm`|`apache`|✅| -|`adeliom/php:7.4-apache-wkhtmltopdf-node16`|`7.4`|`16`|`fpm`|`apache`|✅| -|`adeliom/php:8.0-apache-wkhtmltopdf-node16`|`8.0`|`16`|`fpm`|`apache`|✅| -|`adeliom/php:8.1-apache-wkhtmltopdf-node16`|`8.1`|`16`|`fpm`|`apache`|✅| -|`adeliom/php:8.2-apache-wkhtmltopdf-node16`|`8.2`|`16`|`fpm`|`apache`|✅| -|`adeliom/php:8.3-apache-wkhtmltopdf-node16`|`8.3`|`16`|`fpm`|`apache`|✅| -|`adeliom/php:7.4-apache-wkhtmltopdf-node18`|`7.4`|`18`|`fpm`|`apache`|✅| -|`adeliom/php:8.0-apache-wkhtmltopdf-node18`|`8.0`|`18`|`fpm`|`apache`|✅| -|`adeliom/php:8.1-apache-wkhtmltopdf-node18`|`8.1`|`18`|`fpm`|`apache`|✅| -|`adeliom/php:8.2-apache-wkhtmltopdf-node18`|`8.2`|`18`|`fpm`|`apache`|✅| -|`adeliom/php:8.3-apache-wkhtmltopdf-node18`|`8.3`|`18`|`fpm`|`apache`|✅| -|`adeliom/php:7.4-apache-wkhtmltopdf-node20`|`7.4`|`20`|`fpm`|`apache`|✅| -|`adeliom/php:8.0-apache-wkhtmltopdf-node20`|`8.0`|`20`|`fpm`|`apache`|✅| -|`adeliom/php:8.1-apache-wkhtmltopdf-node20`|`8.1`|`20`|`fpm`|`apache`|✅| -|`adeliom/php:8.2-apache-wkhtmltopdf-node20`|`8.2`|`20`|`fpm`|`apache`|✅| -|`adeliom/php:8.3-apache-wkhtmltopdf-node20`|`8.3`|`20`|`fpm`|`apache`|✅| -|`adeliom/php:7.4-apache-wkhtmltopdf-node21`|`7.4`|`21`|`fpm`|`apache`|✅| -|`adeliom/php:8.0-apache-wkhtmltopdf-node21`|`8.0`|`21`|`fpm`|`apache`|✅| -|`adeliom/php:8.1-apache-wkhtmltopdf-node21`|`8.1`|`21`|`fpm`|`apache`|✅| -|`adeliom/php:8.2-apache-wkhtmltopdf-node21`|`8.2`|`21`|`fpm`|`apache`|✅| -|`adeliom/php:8.3-apache-wkhtmltopdf-node21`|`8.3`|`21`|`fpm`|`apache`|✅| -|`adeliom/php:7.4-nginx`|`7.4`||`fpm`|`nginx`|| -|`adeliom/php:8.0-nginx`|`8.0`||`fpm`|`nginx`|| -|`adeliom/php:8.1-nginx`|`8.1`||`fpm`|`nginx`|| -|`adeliom/php:8.2-nginx`|`8.2`||`fpm`|`nginx`|| -|`adeliom/php:8.3-nginx`|`8.3`||`fpm`|`nginx`|| -|`adeliom/php:7.4-nginx-node16`|`7.4`|`16`|`fpm`|`nginx`|| -|`adeliom/php:8.0-nginx-node16`|`8.0`|`16`|`fpm`|`nginx`|| -|`adeliom/php:8.1-nginx-node16`|`8.1`|`16`|`fpm`|`nginx`|| -|`adeliom/php:8.2-nginx-node16`|`8.2`|`16`|`fpm`|`nginx`|| -|`adeliom/php:8.3-nginx-node16`|`8.3`|`16`|`fpm`|`nginx`|| -|`adeliom/php:7.4-nginx-node18`|`7.4`|`18`|`fpm`|`nginx`|| -|`adeliom/php:8.0-nginx-node18`|`8.0`|`18`|`fpm`|`nginx`|| -|`adeliom/php:8.1-nginx-node18`|`8.1`|`18`|`fpm`|`nginx`|| -|`adeliom/php:8.2-nginx-node18`|`8.2`|`18`|`fpm`|`nginx`|| -|`adeliom/php:8.3-nginx-node18`|`8.3`|`18`|`fpm`|`nginx`|| -|`adeliom/php:7.4-nginx-node20`|`7.4`|`20`|`fpm`|`nginx`|| -|`adeliom/php:8.0-nginx-node20`|`8.0`|`20`|`fpm`|`nginx`|| -|`adeliom/php:8.1-nginx-node20`|`8.1`|`20`|`fpm`|`nginx`|| -|`adeliom/php:8.2-nginx-node20`|`8.2`|`20`|`fpm`|`nginx`|| -|`adeliom/php:8.3-nginx-node20`|`8.3`|`20`|`fpm`|`nginx`|| -|`adeliom/php:7.4-nginx-node21`|`7.4`|`21`|`fpm`|`nginx`|| -|`adeliom/php:8.0-nginx-node21`|`8.0`|`21`|`fpm`|`nginx`|| -|`adeliom/php:8.1-nginx-node21`|`8.1`|`21`|`fpm`|`nginx`|| -|`adeliom/php:8.2-nginx-node21`|`8.2`|`21`|`fpm`|`nginx`|| -|`adeliom/php:8.3-nginx-node21`|`8.3`|`21`|`fpm`|`nginx`|| -|`adeliom/php:7.4-nginx-wkhtmltopdf`|`7.4`||`fpm`|`nginx`|✅| -|`adeliom/php:8.0-nginx-wkhtmltopdf`|`8.0`||`fpm`|`nginx`|✅| -|`adeliom/php:8.1-nginx-wkhtmltopdf`|`8.1`||`fpm`|`nginx`|✅| -|`adeliom/php:8.2-nginx-wkhtmltopdf`|`8.2`||`fpm`|`nginx`|✅| -|`adeliom/php:8.3-nginx-wkhtmltopdf`|`8.3`||`fpm`|`nginx`|✅| -|`adeliom/php:7.4-nginx-wkhtmltopdf-node16`|`7.4`|`16`|`fpm`|`nginx`|✅| -|`adeliom/php:8.0-nginx-wkhtmltopdf-node16`|`8.0`|`16`|`fpm`|`nginx`|✅| -|`adeliom/php:8.1-nginx-wkhtmltopdf-node16`|`8.1`|`16`|`fpm`|`nginx`|✅| -|`adeliom/php:8.2-nginx-wkhtmltopdf-node16`|`8.2`|`16`|`fpm`|`nginx`|✅| -|`adeliom/php:8.3-nginx-wkhtmltopdf-node16`|`8.3`|`16`|`fpm`|`nginx`|✅| -|`adeliom/php:7.4-nginx-wkhtmltopdf-node18`|`7.4`|`18`|`fpm`|`nginx`|✅| -|`adeliom/php:8.0-nginx-wkhtmltopdf-node18`|`8.0`|`18`|`fpm`|`nginx`|✅| -|`adeliom/php:8.1-nginx-wkhtmltopdf-node18`|`8.1`|`18`|`fpm`|`nginx`|✅| -|`adeliom/php:8.2-nginx-wkhtmltopdf-node18`|`8.2`|`18`|`fpm`|`nginx`|✅| -|`adeliom/php:8.3-nginx-wkhtmltopdf-node18`|`8.3`|`18`|`fpm`|`nginx`|✅| -|`adeliom/php:7.4-nginx-wkhtmltopdf-node20`|`7.4`|`20`|`fpm`|`nginx`|✅| -|`adeliom/php:8.0-nginx-wkhtmltopdf-node20`|`8.0`|`20`|`fpm`|`nginx`|✅| -|`adeliom/php:8.1-nginx-wkhtmltopdf-node20`|`8.1`|`20`|`fpm`|`nginx`|✅| -|`adeliom/php:8.2-nginx-wkhtmltopdf-node20`|`8.2`|`20`|`fpm`|`nginx`|✅| -|`adeliom/php:8.3-nginx-wkhtmltopdf-node20`|`8.3`|`20`|`fpm`|`nginx`|✅| -|`adeliom/php:7.4-nginx-wkhtmltopdf-node21`|`7.4`|`21`|`fpm`|`nginx`|✅| -|`adeliom/php:8.0-nginx-wkhtmltopdf-node21`|`8.0`|`21`|`fpm`|`nginx`|✅| -|`adeliom/php:8.1-nginx-wkhtmltopdf-node21`|`8.1`|`21`|`fpm`|`nginx`|✅| -|`adeliom/php:8.2-nginx-wkhtmltopdf-node21`|`8.2`|`21`|`fpm`|`nginx`|✅| -|`adeliom/php:8.3-nginx-wkhtmltopdf-node21`|`8.3`|`21`|`fpm`|`nginx`|✅| -|`adeliom/php:7.4-caddy`|`7.4`||`fpm`|`caddy`|| -|`adeliom/php:8.0-caddy`|`8.0`||`fpm`|`caddy`|| -|`adeliom/php:8.1-caddy`|`8.1`||`fpm`|`caddy`|| -|`adeliom/php:8.2-caddy`|`8.2`||`fpm`|`caddy`|| -|`adeliom/php:8.3-caddy`|`8.3`||`fpm`|`caddy`|| -|`adeliom/php:7.4-caddy-node16`|`7.4`|`16`|`fpm`|`caddy`|| -|`adeliom/php:8.0-caddy-node16`|`8.0`|`16`|`fpm`|`caddy`|| -|`adeliom/php:8.1-caddy-node16`|`8.1`|`16`|`fpm`|`caddy`|| -|`adeliom/php:8.2-caddy-node16`|`8.2`|`16`|`fpm`|`caddy`|| -|`adeliom/php:8.3-caddy-node16`|`8.3`|`16`|`fpm`|`caddy`|| -|`adeliom/php:7.4-caddy-node18`|`7.4`|`18`|`fpm`|`caddy`|| -|`adeliom/php:8.0-caddy-node18`|`8.0`|`18`|`fpm`|`caddy`|| -|`adeliom/php:8.1-caddy-node18`|`8.1`|`18`|`fpm`|`caddy`|| -|`adeliom/php:8.2-caddy-node18`|`8.2`|`18`|`fpm`|`caddy`|| -|`adeliom/php:8.3-caddy-node18`|`8.3`|`18`|`fpm`|`caddy`|| -|`adeliom/php:7.4-caddy-node20`|`7.4`|`20`|`fpm`|`caddy`|| -|`adeliom/php:8.0-caddy-node20`|`8.0`|`20`|`fpm`|`caddy`|| -|`adeliom/php:8.1-caddy-node20`|`8.1`|`20`|`fpm`|`caddy`|| -|`adeliom/php:8.2-caddy-node20`|`8.2`|`20`|`fpm`|`caddy`|| -|`adeliom/php:8.3-caddy-node20`|`8.3`|`20`|`fpm`|`caddy`|| -|`adeliom/php:7.4-caddy-node21`|`7.4`|`21`|`fpm`|`caddy`|| -|`adeliom/php:8.0-caddy-node21`|`8.0`|`21`|`fpm`|`caddy`|| -|`adeliom/php:8.1-caddy-node21`|`8.1`|`21`|`fpm`|`caddy`|| -|`adeliom/php:8.2-caddy-node21`|`8.2`|`21`|`fpm`|`caddy`|| -|`adeliom/php:8.3-caddy-node21`|`8.3`|`21`|`fpm`|`caddy`|| -|`adeliom/php:7.4-caddy-wkhtmltopdf`|`7.4`||`fpm`|`caddy`|✅| -|`adeliom/php:8.0-caddy-wkhtmltopdf`|`8.0`||`fpm`|`caddy`|✅| -|`adeliom/php:8.1-caddy-wkhtmltopdf`|`8.1`||`fpm`|`caddy`|✅| -|`adeliom/php:8.2-caddy-wkhtmltopdf`|`8.2`||`fpm`|`caddy`|✅| -|`adeliom/php:8.3-caddy-wkhtmltopdf`|`8.3`||`fpm`|`caddy`|✅| -|`adeliom/php:7.4-caddy-wkhtmltopdf-node16`|`7.4`|`16`|`fpm`|`caddy`|✅| -|`adeliom/php:8.0-caddy-wkhtmltopdf-node16`|`8.0`|`16`|`fpm`|`caddy`|✅| -|`adeliom/php:8.1-caddy-wkhtmltopdf-node16`|`8.1`|`16`|`fpm`|`caddy`|✅| -|`adeliom/php:8.2-caddy-wkhtmltopdf-node16`|`8.2`|`16`|`fpm`|`caddy`|✅| -|`adeliom/php:8.3-caddy-wkhtmltopdf-node16`|`8.3`|`16`|`fpm`|`caddy`|✅| -|`adeliom/php:7.4-caddy-wkhtmltopdf-node18`|`7.4`|`18`|`fpm`|`caddy`|✅| -|`adeliom/php:8.0-caddy-wkhtmltopdf-node18`|`8.0`|`18`|`fpm`|`caddy`|✅| -|`adeliom/php:8.1-caddy-wkhtmltopdf-node18`|`8.1`|`18`|`fpm`|`caddy`|✅| -|`adeliom/php:8.2-caddy-wkhtmltopdf-node18`|`8.2`|`18`|`fpm`|`caddy`|✅| -|`adeliom/php:8.3-caddy-wkhtmltopdf-node18`|`8.3`|`18`|`fpm`|`caddy`|✅| -|`adeliom/php:7.4-caddy-wkhtmltopdf-node20`|`7.4`|`20`|`fpm`|`caddy`|✅| -|`adeliom/php:8.0-caddy-wkhtmltopdf-node20`|`8.0`|`20`|`fpm`|`caddy`|✅| -|`adeliom/php:8.1-caddy-wkhtmltopdf-node20`|`8.1`|`20`|`fpm`|`caddy`|✅| -|`adeliom/php:8.2-caddy-wkhtmltopdf-node20`|`8.2`|`20`|`fpm`|`caddy`|✅| -|`adeliom/php:8.3-caddy-wkhtmltopdf-node20`|`8.3`|`20`|`fpm`|`caddy`|✅| -|`adeliom/php:7.4-caddy-wkhtmltopdf-node21`|`7.4`|`21`|`fpm`|`caddy`|✅| -|`adeliom/php:8.0-caddy-wkhtmltopdf-node21`|`8.0`|`21`|`fpm`|`caddy`|✅| -|`adeliom/php:8.1-caddy-wkhtmltopdf-node21`|`8.1`|`21`|`fpm`|`caddy`|✅| -|`adeliom/php:8.2-caddy-wkhtmltopdf-node21`|`8.2`|`21`|`fpm`|`caddy`|✅| -|`adeliom/php:8.3-caddy-wkhtmltopdf-node21`|`8.3`|`21`|`fpm`|`caddy`|✅| - +| Name | PHP version | variant | server | wkhtmltopdf | +| ---------------------------------------- | ----------- | ------- | ------------ | :---------: | +| `adeliom/php:8.1-cli` | `8.1` | `cli` | | | +| `adeliom/php:8.2-cli` | `8.2` | `cli` | | | +| `adeliom/php:8.3-cli` | `8.3` | `cli` | | | +| `adeliom/php:8.4-cli` | `8.4` | `cli` | | | +| `adeliom/php:8.1-cli-wkhtmltopdf` | `8.1` | `cli` | | ✅ | +| `adeliom/php:8.2-cli-wkhtmltopdf` | `8.2` | `cli` | | ✅ | +| `adeliom/php:8.3-cli-wkhtmltopdf` | `8.3` | `cli` | | ✅ | +| `adeliom/php:8.4-cli-wkhtmltopdf` | `8.4` | `cli` | | ✅ | +| `adeliom/php:8.1-fpm` | `8.1` | `fpm` | | | +| `adeliom/php:8.2-fpm` | `8.2` | `fpm` | | | +| `adeliom/php:8.3-fpm` | `8.3` | `fpm` | | | +| `adeliom/php:8.4-fpm` | `8.4` | `fpm` | | | +| `adeliom/php:8.1-fpm-wkhtmltopdf` | `8.1` | `fpm` | | ✅ | +| `adeliom/php:8.2-fpm-wkhtmltopdf` | `8.2` | `fpm` | | ✅ | +| `adeliom/php:8.3-fpm-wkhtmltopdf` | `8.3` | `fpm` | | ✅ | +| `adeliom/php:8.4-fpm-wkhtmltopdf` | `8.4` | `fpm` | | ✅ | +| `adeliom/php:8.1-apache` | `8.1` | `fpm` | `apache` | | +| `adeliom/php:8.2-apache` | `8.2` | `fpm` | `apache` | | +| `adeliom/php:8.3-apache` | `8.3` | `fpm` | `apache` | | +| `adeliom/php:8.4-apache` | `8.4` | `fpm` | `apache` | | +| `adeliom/php:8.1-apache-wkhtmltopdf` | `8.1` | `fpm` | `apache` | ✅ | +| `adeliom/php:8.2-apache-wkhtmltopdf` | `8.2` | `fpm` | `apache` | ✅ | +| `adeliom/php:8.3-apache-wkhtmltopdf` | `8.3` | `fpm` | `apache` | ✅ | +| `adeliom/php:8.4-apache-wkhtmltopdf` | `8.4` | `fpm` | `apache` | ✅ | +| `adeliom/php:8.1-nginx` | `8.1` | `fpm` | `nginx` | | +| `adeliom/php:8.2-nginx` | `8.2` | `fpm` | `nginx` | | +| `adeliom/php:8.3-nginx` | `8.3` | `fpm` | `nginx` | | +| `adeliom/php:8.4-nginx` | `8.4` | `fpm` | `nginx` | | +| `adeliom/php:8.1-nginx-wkhtmltopdf` | `8.1` | `fpm` | `nginx` | ✅ | +| `adeliom/php:8.2-nginx-wkhtmltopdf` | `8.2` | `fpm` | `nginx` | ✅ | +| `adeliom/php:8.3-nginx-wkhtmltopdf` | `8.3` | `fpm` | `nginx` | ✅ | +| `adeliom/php:8.4-nginx-wkhtmltopdf` | `8.4` | `fpm` | `nginx` | ✅ | +| `adeliom/php:8.1-caddy` | `8.1` | `fpm` | `caddy` | | +| `adeliom/php:8.2-caddy` | `8.2` | `fpm` | `caddy` | | +| `adeliom/php:8.3-caddy` | `8.3` | `fpm` | `caddy` | | +| `adeliom/php:8.4-caddy` | `8.4` | `fpm` | `caddy` | | +| `adeliom/php:8.1-caddy-wkhtmltopdf` | `8.1` | `fpm` | `caddy` | ✅ | +| `adeliom/php:8.2-caddy-wkhtmltopdf` | `8.2` | `fpm` | `caddy` | ✅ | +| `adeliom/php:8.3-caddy-wkhtmltopdf` | `8.3` | `fpm` | `caddy` | ✅ | +| `adeliom/php:8.4-caddy-wkhtmltopdf` | `8.4` | `fpm` | `caddy` | ✅ | +| `adeliom/php:8.2-frankenphp` | `8.2` | `php` | `frankenphp` | | +| `adeliom/php:8.3-frankenphp` | `8.3` | `php` | `frankenphp` | | +| `adeliom/php:8.2-frankenphp-wkhtmltopdf` | `8.2` | `php` | `frankenphp` | ✅ | +| `adeliom/php:8.3-frankenphp-wkhtmltopdf` | `8.3` | `php` | `frankenphp` | ✅ | ## Usage @@ -179,51 +66,38 @@ These images are based on the [official PHP image](https://hub.docker.com/_/php/ Example with CLI: ```bash -$ docker run -it --rm --name my-running-script -v "$PWD":/var/www/html adeliom/php:8.1-cli php your-script.php +$ docker run -it --rm --name my-running-script -v "$PWD":/var/www/html adeliom/php:8.2-cli php your-script.php ``` Example with Apache: ```bash -$ docker run -p 80:80 --rm --name my-apache-php-app -v "$PWD":/var/www/html adeliom/php:8.1-apache +$ docker run -p 80:80 --rm --name my-apache-php-app -v "$PWD":/var/www/html adeliom/php:8.2-apache ``` Example with PHP-FPM: ```bash -$ docker run -p 9000:9000 --rm --name my-php-fpm -v "$PWD":/var/www/html adeliom/php:8.1-fpm -``` - -Example with Apache + Node 16.x in a Dockerfile: - -**Dockerfile** -```Dockerfile -FROM adeliom/php:8.1-apache-node16 - -COPY src/ /var/www/html/ -RUN composer install -RUN npm install -RUN npm run build +$ docker run -p 9000:9000 --rm --name my-php-fpm -v "$PWD":/var/www/html adeliom/php:8.2-fpm ``` - ## Default working directory The working directory (the directory in which you should mount/copy your application) depends on the image variant you are using: -| Variant | Working directory | -|---------|-------------------| -| cli | `/var/www/html` | -| fpm | `/var/www/html` | -| apache | `/var/www/html` | -| nginx | `/var/www/html` | -| caddy | `/var/www/html` | - +| Variant | Working directory | +| ---------- | ----------------- | +| cli | `/var/www/html` | +| fpm | `/var/www/html` | +| apache | `/var/www/html` | +| nginx | `/var/www/html` | +| caddy | `/var/www/html` | +| frankenphp | `/var/www/html` | ## Changing server document root -For all server variants, you can change the document root (i.e. your "public" directory) by using the +For all server variants, you can change the document root (i.e. your "public" directory) by using the `DOCUMENT_ROOT` variable: ```bash @@ -233,32 +107,32 @@ DOCUMENT_ROOT=/var/www/html/public/ ## Setting parameters in php.ini -| PHP.ini variable |Environement variable name| Default value | -|----|----|----| -| `memory_limit` | PHP_INI_MEMORY_LIMIT | `128M` (fpm) `-1` (cli) | -| `date.timezone` | PHP_INI_DATE_TIMEZONE | `UTC` | -| `cgi.fix_pathinfo` | PHP_INI_CGI_FIX_PATHINFO | `1` | -| `upload_max_filesize` | PHP_INI_UPLOAD_MAX_FILESIZE | `16M` | -| `post_max_size` | PHP_INI_POST_MAX_SIZE | `16M` | -| `error_reporting` | PHP_INI_ERROR_REPORTING | `E_ALL & ~E_DEPRECATED & ~E_STRICT` | -| `display_errors` | PHP_INI_DISPLAY_ERRORS | `Off` | -| `display_startup_errors` | PHP_INI_DISPLAY_STARTUP_ERRORS | `Off` | -| `realpath_cache_size` | PHP_INI_REALPATH_CACHE_SIZE | `4096k` | -| `realpath_cache_ttl` | PHP_INI_REALPATH_CACHE_TTL | `120` | -| `opcache.memory_consumption` | PHP_INI_OPCACHE_MEMORY_CONSUMPTION | `128` | -| `opcache.interned_strings_buffer` | PHP_INI_OPCACHE_INTERNED_STRINGS_BUFFER | `8` | -| `opcache.max_accelerated_files` | PHP_INI_OPCACHE_MAX_ACCELERATED_FILES | `4000` | -| `opcache.revalidate_freq` | PHP_INI_OPCACHE_REVALIDATE_FREQ | `60` | -| `opcache.validate_timestamps` | PHP_INI_OPCACHE_VALIDATE_TIMESTAMPS | `1` | -| `opcache.fast_shutdown` | PHP_INI_OPCACHE_FAST_SHUTDOWN | `1` | -| `opcache.enable_cli` | PHP_INI_OPCACHE_ENABLE_CLI | `1` | -| `opcache.enable` | PHP_INI_OPCACHE_ENABLE | `1` -| `opcache.preload` | PHP_INI_OPCACHE_PRELOAD | `` -| `opcache.preload_user` | PHP_INI_OPCACHE_PRELOAD_USER | `` -| `soap.wsdl_cache_enabled` | PHP_INI_SOAP_WSDL_CACHE_ENABLED | `1` | -| `max_execution_time` | PHP_INI_MAX_EXECUTION_TIME | `30` | -| `max_input_time` | PHP_INI_MAX_INPUT_TIME | `60` | -| `sendmail_path` | PHP_INI_SENDMAIL_PATH | `sendmail -t -i` | +| PHP.ini variable | Environement variable name | Default value | +| --------------------------------- | --------------------------------------- | ----------------------------------- | +| `memory_limit` | PHP_INI_MEMORY_LIMIT | `128M` (fpm) `-1` (cli) | +| `date.timezone` | PHP_INI_DATE_TIMEZONE | `UTC` | +| `cgi.fix_pathinfo` | PHP_INI_CGI_FIX_PATHINFO | `1` | +| `upload_max_filesize` | PHP_INI_UPLOAD_MAX_FILESIZE | `16M` | +| `post_max_size` | PHP_INI_POST_MAX_SIZE | `16M` | +| `error_reporting` | PHP_INI_ERROR_REPORTING | `E_ALL & ~E_DEPRECATED & ~E_STRICT` | +| `display_errors` | PHP_INI_DISPLAY_ERRORS | `Off` | +| `display_startup_errors` | PHP_INI_DISPLAY_STARTUP_ERRORS | `Off` | +| `realpath_cache_size` | PHP_INI_REALPATH_CACHE_SIZE | `4096k` | +| `realpath_cache_ttl` | PHP_INI_REALPATH_CACHE_TTL | `120` | +| `opcache.memory_consumption` | PHP_INI_OPCACHE_MEMORY_CONSUMPTION | `128` | +| `opcache.interned_strings_buffer` | PHP_INI_OPCACHE_INTERNED_STRINGS_BUFFER | `8` | +| `opcache.max_accelerated_files` | PHP_INI_OPCACHE_MAX_ACCELERATED_FILES | `4000` | +| `opcache.revalidate_freq` | PHP_INI_OPCACHE_REVALIDATE_FREQ | `60` | +| `opcache.validate_timestamps` | PHP_INI_OPCACHE_VALIDATE_TIMESTAMPS | `1` | +| `opcache.fast_shutdown` | PHP_INI_OPCACHE_FAST_SHUTDOWN | `1` | +| `opcache.enable_cli` | PHP_INI_OPCACHE_ENABLE_CLI | `1` | +| `opcache.enable` | PHP_INI_OPCACHE_ENABLE | `1` | +| `opcache.preload` | PHP_INI_OPCACHE_PRELOAD | `` | +| `opcache.preload_user` | PHP_INI_OPCACHE_PRELOAD_USER | `` | +| `soap.wsdl_cache_enabled` | PHP_INI_SOAP_WSDL_CACHE_ENABLED | `1` | +| `max_execution_time` | PHP_INI_MAX_EXECUTION_TIME | `30` | +| `max_input_time` | PHP_INI_MAX_INPUT_TIME | `60` | +| `sendmail_path` | PHP_INI_SENDMAIL_PATH | `sendmail -t -i` | ## Debugging @@ -273,7 +147,7 @@ You can setup your own xdebug config by following the documentation of [Xdebug]( ## Extensions available -These extensions are enabled by default in images : `amqp` `ctype` `curl` `date` `dom` `exif` `fileinfo` `filter` `ftp` `gd` `gettext` `hash` `iconv` `imagick` `intl` `json` `ldap` `libxml` `mbstring` `mongodb` `mysqli` `mysqlnd` `openssl` `pcre` `PDO` `pdo_mysql` `pdo_pgsql` `pdo_sqlite` `pgsql` `Phar` `posix` `readline` `redis` `Reflection` `session` `SimpleXML` `soap` `sodium` `SPL` `sqlite3` `standard` `swoole` `sysvsem` `tokenizer` `xdebug` `xml` `xmlreader` `xmlwriter` `opcache` `zip` `zlib` +These extensions are enabled by default in images : `amqp` `ctype` `curl` `date` `dom` `exif` `fileinfo` `filter` `ftp` `gd` `gettext` `hash` `iconv` `imagick` `intl` `json` `ldap` `libxml` `mbstring` `mongodb` `mysqli` `mysqlnd` `openssl` `pcre` `PDO` `pdo_mysql` `pdo_pgsql` `pdo_sqlite` `pgsql` `Phar` `posix` `readline` `redis` `Reflection` `session` `SimpleXML` `soap` `sodium` `SPL` `sqlite3` `standard` `swoole` `sysvsem` `tokenizer` `xdebug` `xml` `xmlreader` `xmlwriter` `opcache` `zip` `zlib` This list can be outdated, you can verify by executing : `docker run --rm -it adeliom/php:8.1-cli php -m` @@ -286,5 +160,6 @@ FROM adeliom/php:8.1-apache RUN install-php-extensions tidy ``` ------ -Made with ❤️ by [@agence-adeliom](https://github.com/agence-adeliom) \ No newline at end of file +--- + +Made with ❤️ by [@agence-adeliom](https://github.com/agence-adeliom) diff --git a/php/config/caddy/Caddyfile b/php/config/caddy/Caddyfile index 76f74f0..b5f16b0 100755 --- a/php/config/caddy/Caddyfile +++ b/php/config/caddy/Caddyfile @@ -1,46 +1,59 @@ -:80 { - root * {$DOCUMENT_ROOT:/var/www/html/} - - trusted_proxies private_ranges +{ + {$CADDY_GLOBAL_OPTIONS} + + servers { + metrics + timeouts { + read_body 10s + read_header 5s + write 30s + idle 10m + } + trusted_proxies static private_ranges + } + log { + format json + level INFO + } +} - # Point all PHP requests to an upstream socket, served by php-fpm - php_fastcgi localhost:9000 +{$CADDY_EXTRA_CONFIG} +{$SERVER_NAME:localhost} { # Enable logging log { - output stderr - format console - level ERROR - } - - log { - output discard + output stdout level INFO + # Redact the authorization query parameter that can be set by Mercure format filter { - # Defaults to json while waiting for https://github.com/caddyserver/caddy/pull/5980 - wrap json fields { - uri query { + request>uri query { replace authorization REDACTED } } + wrap json } } - # Serve static files - file_server + root * {$DOCUMENT_ROOT:/var/www/html/} + + log_skip /robots.txt + log_skip /healthz + log_skip /ping + log_skip /status + log_skip /favicon.ico - # Enable gzip compression (and zstd) + respond /healthz "healthy" 200 + + root * {$DOCUMENT_ROOT:/var/www/html/} + encode zstd gzip - skip_log /robots.txt - skip_log /healthz - skip_log /favicon.ico + {$CADDY_SERVER_EXTRA_DIRECTIVES} - respond /healthz 200 -} + # Point all PHP requests to an upstream socket, served by php-fpm + php_fastcgi 127.0.0.1:9000 -:2021 { - tls internal - metrics + # Serve static files + file_server } \ No newline at end of file diff --git a/php/config/frankenphp/Caddyfile b/php/config/frankenphp/Caddyfile new file mode 100644 index 0000000..8aa9f72 --- /dev/null +++ b/php/config/frankenphp/Caddyfile @@ -0,0 +1,75 @@ +{ + {$CADDY_GLOBAL_OPTIONS} + + servers { + metrics + timeouts { + read_body 10s + read_header 5s + write 30s + idle 10m + } + trusted_proxies static private_ranges + } + log { + format json + level INFO + } + + frankenphp { + #worker /path/to/your/worker.php + {$FRANKENPHP_CONFIG} + } +} + +{$CADDY_EXTRA_CONFIG} + +{$SERVER_NAME:localhost} { + # Enable logging + log { + output stdout + level INFO + # Redact the authorization query parameter that can be set by Mercure + format filter { + fields { + request>uri query { + replace authorization REDACTED + } + } + wrap json + } + } + + log_skip /robots.txt + log_skip /healthz + log_skip /ping + log_skip /status + log_skip /favicon.ico + + respond /healthz "healthy" 200 + + root * {$DOCUMENT_ROOT:/var/www/html/} + + encode zstd br gzip + + # Uncomment the following lines to enable Mercure and Vulcain modules + #mercure { + # # Transport to use (default to Bolt) + # transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db} + # # Publisher JWT key + # publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG} + # # Subscriber JWT key + # subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG} + # # Allow anonymous subscribers (double-check that it's what you want) + # anonymous + # # Enable the subscription API (double-check that it's what you want) + # subscriptions + # # Extra directives + # {$MERCURE_EXTRA_DIRECTIVES} + #} + #vulcain + + {$CADDY_SERVER_EXTRA_DIRECTIVES} + + php_server +} diff --git a/php/config/nginx/20-envsubst-on-templates.sh b/php/config/nginx/20-envsubst-on-templates.sh index eb10b67..41c97fa 100644 --- a/php/config/nginx/20-envsubst-on-templates.sh +++ b/php/config/nginx/20-envsubst-on-templates.sh @@ -31,7 +31,7 @@ END auto_envsubst() { local template_dir="${NGINX_ENVSUBST_TEMPLATE_DIR:-/etc/nginx/templates}" local suffix="${NGINX_ENVSUBST_TEMPLATE_SUFFIX:-.template}" - local output_dir="${NGINX_ENVSUBST_OUTPUT_DIR:-/etc/nginx/conf.d}" + local output_dir="${NGINX_ENVSUBST_OUTPUT_DIR:-/tmp/nginx/conf.d}" local stream_suffix="${NGINX_ENVSUBST_STREAM_TEMPLATE_SUFFIX:-.stream-template}" local stream_output_dir="${NGINX_ENVSUBST_STREAM_OUTPUT_DIR:-/etc/nginx/stream-conf.d}" local filter="${NGINX_ENVSUBST_FILTER:-}" diff --git a/php/config/nginx/docker-entrypoint.sh b/php/config/nginx/docker-entrypoint.sh index 8c3cff5..1f1696c 100644 --- a/php/config/nginx/docker-entrypoint.sh +++ b/php/config/nginx/docker-entrypoint.sh @@ -9,39 +9,37 @@ entrypoint_log() { fi } -if [ "$1" = "nginx" ] || [ "$1" = "nginx-debug" ]; then - if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then - entrypoint_log "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration" +if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then + entrypoint_log "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration" - entrypoint_log "$0: Looking for shell scripts in /docker-entrypoint.d/" - find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do - case "$f" in - *.envsh) - if [ -x "$f" ]; then - entrypoint_log "$0: Sourcing $f"; - . "$f" - else - # warn on shell scripts without exec bit - entrypoint_log "$0: Ignoring $f, not executable"; - fi - ;; - *.sh) - if [ -x "$f" ]; then - entrypoint_log "$0: Launching $f"; - "$f" - else - # warn on shell scripts without exec bit - entrypoint_log "$0: Ignoring $f, not executable"; - fi - ;; - *) entrypoint_log "$0: Ignoring $f";; - esac - done + entrypoint_log "$0: Looking for shell scripts in /docker-entrypoint.d/" + find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do + case "$f" in + *.envsh) + if [ -x "$f" ]; then + entrypoint_log "$0: Sourcing $f"; + . "$f" + else + # warn on shell scripts without exec bit + entrypoint_log "$0: Ignoring $f, not executable"; + fi + ;; + *.sh) + if [ -x "$f" ]; then + entrypoint_log "$0: Launching $f"; + "$f" + else + # warn on shell scripts without exec bit + entrypoint_log "$0: Ignoring $f, not executable"; + fi + ;; + *) entrypoint_log "$0: Ignoring $f";; + esac + done - entrypoint_log "$0: Configuration complete; ready for start up" - else - entrypoint_log "$0: No files found in /docker-entrypoint.d/, skipping configuration" - fi + entrypoint_log "$0: Configuration complete; ready for start up" +else + entrypoint_log "$0: No files found in /docker-entrypoint.d/, skipping configuration" fi if [ "${1}" = "-D" ]; then diff --git a/php/config/nginx/nginx.conf b/php/config/nginx/nginx.conf index 34a31ca..9108353 100644 --- a/php/config/nginx/nginx.conf +++ b/php/config/nginx/nginx.conf @@ -48,6 +48,7 @@ http { text/plain text/xml; include /etc/nginx/conf.d/*.conf; + include /tmp/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; open_file_cache max=100; client_max_body_size 1G; diff --git a/test/index.php b/test/index.php new file mode 100644 index 0000000..67c5566 --- /dev/null +++ b/test/index.php @@ -0,0 +1,14 @@ +