From 7c87ba597e9a7118fca1d98fdef7e0225e9ec8b1 Mon Sep 17 00:00:00 2001 From: Aditya Prima Date: Thu, 12 Sep 2024 00:42:37 +0700 Subject: [PATCH] Added rootless images --- .gitea/workflows/alpine-dockerio.yaml | 215 +++++++++++++++++++++++ .gitea/workflows/alpine-winter.yaml | 107 +++++++++++- .gitea/workflows/ubuntu-dockerio.yaml | 217 ++++++++++++++++++++++++ .gitea/workflows/ubuntu-winter.yaml | 110 +++++++++++- Dockerfile.alpine | 4 + Dockerfile.alpine-rootless | 41 +++++ Dockerfile.ubuntu | 4 + Dockerfile.ubuntu-rootless | 39 +++++ etc/php/fpm/pool.d-rootless/00-www.conf | 55 ++++++ 9 files changed, 789 insertions(+), 3 deletions(-) create mode 100644 .gitea/workflows/alpine-dockerio.yaml create mode 100644 .gitea/workflows/ubuntu-dockerio.yaml create mode 100644 Dockerfile.alpine-rootless create mode 100644 Dockerfile.ubuntu-rootless create mode 100644 etc/php/fpm/pool.d-rootless/00-www.conf diff --git a/.gitea/workflows/alpine-dockerio.yaml b/.gitea/workflows/alpine-dockerio.yaml new file mode 100644 index 0000000..a665c4f --- /dev/null +++ b/.gitea/workflows/alpine-dockerio.yaml @@ -0,0 +1,215 @@ +name: Build and Push Alpine Image +on: + push: + branches: + - master + +jobs: + build: + name: Build and push image (root-user) + runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:act-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Login to Docker Winter Access Git Registry + uses: docker/login-action@v3 + with: + registry: docker.io + username: aprimediet + password: ${{ secrets.DOCKER_TOKEN }} + - name: Build and push 5.6 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine + build-args: | + PHP_VERSION=5.6 + ALPINE_VERSION=3.5 + push: true + tags: | + aprimediet/php-fpm:5.6-alpine + - name: Build and push 7.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine + build-args: | + PHP_VERSION=7.2 + ALPINE_VERSION=3.9 + push: true + tags: | + aprimediet/php-fpm:7.2-alpine + - name: Build and push 7.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine + build-args: | + PHP_VERSION=7.3 + ALPINE_VERSION=3.10 + push: true + tags: | + aprimediet/php-fpm:7.3-alpine + - name: Build and push 7.4 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine + build-args: | + PHP_VERSION=7.4 + ALPINE_VERSION=3.13 + push: true + tags: | + aprimediet/php-fpm:7.4-alpine + - name: Build and push 8.0 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine + build-args: | + PHP_VERSION=8.0 + ALPINE_VERSION=3.16 + push: true + tags: | + aprimediet/php-fpm:8.0-alpine + - name: Build and push 8.1 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine + build-args: | + PHP_VERSION=8.1 + ALPINE_VERSION=3.18 + push: true + tags: | + aprimediet/php-fpm:8.1-alpine + - name: Build and push 8.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine + build-args: | + PHP_VERSION=8.2 + ALPINE_VERSION=3.18 + push: true + tags: | + aprimediet/php-fpm:8.2-alpine + - name: Build and push 8.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine + build-args: | + PHP_VERSION=8.3 + ALPINE_VERSION=3.19 + push: true + tags: | + aprimediet/php-fpm:8.3-alpine + aprimediet/php-fpm:latest-alpine + aprimediet/php-fpm:alpine + build-rootless: + name: Build and push image (rootless) + runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:act-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Login to Docker Winter Access Git Registry + uses: docker/login-action@v3 + with: + registry: git.winteraccess.id + username: aditya.prima + password: ${{ secrets.PATOKEN }} + - name: Build and push 5.6 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=5.6 + ALPINE_VERSION=3.5 + push: true + tags: | + aprimediet/php-fpm:5.6-alpine-rootless + - name: Build and push 7.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=7.2 + ALPINE_VERSION=3.9 + push: true + tags: | + aprimediet/php-fpm:7.2-alpine-rootless + - name: Build and push 7.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=7.3 + ALPINE_VERSION=3.10 + push: true + tags: | + aprimediet/php-fpm:7.3-alpine-rootless + - name: Build and push 7.4 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=7.4 + ALPINE_VERSION=3.13 + push: true + tags: | + aprimediet/php-fpm:7.4-alpine-rootless + - name: Build and push 8.0 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=8.0 + ALPINE_VERSION=3.16 + push: true + tags: | + aprimediet/php-fpm:8.0-alpine-rootless + - name: Build and push 8.1 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=8.1 + ALPINE_VERSION=3.18 + push: true + tags: | + aprimediet/php-fpm:8.1-alpine-rootless + - name: Build and push 8.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=8.2 + ALPINE_VERSION=3.18 + push: true + tags: | + aprimediet/php-fpm:8.2-alpine-rootless + - name: Build and push 8.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=8.3 + ALPINE_VERSION=3.19 + push: true + tags: | + aprimediet/php-fpm:8.3-alpine-rootless + aprimediet/php-fpm:latest-alpine-rootless + aprimediet/php-fpm:alpine-rootless diff --git a/.gitea/workflows/alpine-winter.yaml b/.gitea/workflows/alpine-winter.yaml index e31433a..7f06792 100644 --- a/.gitea/workflows/alpine-winter.yaml +++ b/.gitea/workflows/alpine-winter.yaml @@ -6,7 +6,7 @@ on: jobs: build: - name: Build and push image + name: Build and push image (root-user) runs-on: ubuntu-latest container: image: ghcr.io/catthehacker/ubuntu:act-latest @@ -108,3 +108,108 @@ jobs: tags: | git.winteraccess.id/${{ gitea.repository }}:8.3-alpine git.winteraccess.id/${{ gitea.repository }}:latest-alpine + git.winteraccess.id/${{ gitea.repository }}:alpine + build-rootless: + name: Build and push image (rootless) + runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:act-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Login to Docker Winter Access Git Registry + uses: docker/login-action@v3 + with: + registry: git.winteraccess.id + username: aditya.prima + password: ${{ secrets.PATOKEN }} + - name: Build and push 5.6 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=5.6 + ALPINE_VERSION=3.5 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:5.6-alpine-rootless + - name: Build and push 7.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=7.2 + ALPINE_VERSION=3.9 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:7.2-alpine-rootless + - name: Build and push 7.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=7.3 + ALPINE_VERSION=3.10 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:7.3-alpine-rootless + - name: Build and push 7.4 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=7.4 + ALPINE_VERSION=3.13 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:7.4-alpine-rootless + - name: Build and push 8.0 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=8.0 + ALPINE_VERSION=3.16 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.0-alpine-rootless + - name: Build and push 8.1 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=8.1 + ALPINE_VERSION=3.18 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.1-alpine-rootless + - name: Build and push 8.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=8.2 + ALPINE_VERSION=3.18 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.2-alpine-rootless + - name: Build and push 8.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.alpine-rootless + build-args: | + PHP_VERSION=8.3 + ALPINE_VERSION=3.19 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.3-alpine-rootless + git.winteraccess.id/${{ gitea.repository }}:latest-alpine-rootless + git.winteraccess.id/${{ gitea.repository }}:alpine-rootless diff --git a/.gitea/workflows/ubuntu-dockerio.yaml b/.gitea/workflows/ubuntu-dockerio.yaml new file mode 100644 index 0000000..8785126 --- /dev/null +++ b/.gitea/workflows/ubuntu-dockerio.yaml @@ -0,0 +1,217 @@ +name: Build and Push Ubuntu Image +on: + push: + branches: + - master + +jobs: + build: + name: Build and push image (root) + runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:act-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: docker.io + username: aprimediet + password: ${{ secrets.DOCKER_TOKEN }} + - name: Build and push 5.6 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=5.6 + push: true + tags: | + aprimediet/php-fpm:5.6 + aprimediet/php-fpm:5.6-ubuntu + - name: Build and push 7.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=7.2 + push: true + tags: | + aprimediet/php-fpm:7.2 + aprimediet/php-fpm:7.2-ubuntu + - name: Build and push 7.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=7.3 + push: true + tags: | + aprimediet/php-fpm:7.3 + aprimediet/php-fpm:7.3-ubuntu + - name: Build and push 7.4 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=7.4 + push: true + tags: | + aprimediet/php-fpm:7.4 + aprimediet/php-fpm:7.4-ubuntu + - name: Build and push 8.0 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=8.0 + push: true + tags: | + aprimediet/php-fpm:8.0 + aprimediet/php-fpm:8.0-ubuntu + - name: Build and push 8.1 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=8.1 + push: true + tags: | + aprimediet/php-fpm:8.1 + aprimediet/php-fpm:8.1-ubuntu + - name: Build and push 8.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=8.2 + push: true + tags: | + aprimediet/php-fpm:8.2 + aprimediet/php-fpm:8.2-ubuntu + - name: Build and push 8.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=8.3 + push: true + tags: | + aprimediet/php-fpm:8.3 + aprimediet/php-fpm:8.3-ubuntu + aprimediet/php-fpm:latest-ubuntu + aprimediet/php-fpm:ubuntu + aprimediet/php-fpm:latest + build-rootless: + name: Build and push image (rootless) + runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:act-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.winteraccess.id + username: aditya.prima + password: ${{ secrets.PATOKEN }} + - name: Build and push 5.6 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=5.6 + push: true + tags: | + aprimediet/php-fpm:5.6-rootless + aprimediet/php-fpm:5.6-ubuntu-rootless + - name: Build and push 7.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=7.2 + push: true + tags: | + aprimediet/php-fpm:7.2-rootless + aprimediet/php-fpm:7.2-ubuntu-rootless + - name: Build and push 7.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=7.3 + push: true + tags: | + aprimediet/php-fpm:7.3-rootless + aprimediet/php-fpm:7.3-ubuntu-rootless + - name: Build and push 7.4 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=7.4 + push: true + tags: | + aprimediet/php-fpm:7.4-rootless + aprimediet/php-fpm:7.4-ubuntu-rootless + - name: Build and push 8.0 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=8.0 + push: true + tags: | + aprimediet/php-fpm:8.0-rootless + aprimediet/php-fpm:8.0-ubuntu-rootless + - name: Build and push 8.1 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=8.1 + push: true + tags: | + aprimediet/php-fpm:8.1-rootless + aprimediet/php-fpm:8.1-ubuntu-rootless + - name: Build and push 8.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=8.2 + push: true + tags: | + aprimediet/php-fpm:8.2-rootless + aprimediet/php-fpm:8.2-ubuntu-rootless + - name: Build and push 8.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=8.3 + push: true + tags: | + aprimediet/php-fpm:8.3-rootless + aprimediet/php-fpm:8.3-ubuntu-rootless + aprimediet/php-fpm:latest-ubuntu-rootless + aprimediet/php-fpm:ubuntu-rootless + aprimediet/php-fpm:latest-rootless diff --git a/.gitea/workflows/ubuntu-winter.yaml b/.gitea/workflows/ubuntu-winter.yaml index ebbf8f6..9d63211 100644 --- a/.gitea/workflows/ubuntu-winter.yaml +++ b/.gitea/workflows/ubuntu-winter.yaml @@ -6,14 +6,14 @@ on: jobs: build: - name: Build and push image + name: Build and push image (root) runs-on: ubuntu-latest container: image: ghcr.io/catthehacker/ubuntu:act-latest steps: - name: Check out repository code uses: actions/checkout@v3 - - name: Login to Docker Winter Access Git Registry + - name: Login to Docker Registry uses: docker/login-action@v3 with: registry: git.winteraccess.id @@ -108,4 +108,110 @@ jobs: git.winteraccess.id/${{ gitea.repository }}:8.3 git.winteraccess.id/${{ gitea.repository }}:8.3-ubuntu git.winteraccess.id/${{ gitea.repository }}:latest-ubuntu + git.winteraccess.id/${{ gitea.repository }}:ubuntu git.winteraccess.id/${{ gitea.repository }}:latest + build-rootless: + name: Build and push image (rootless) + runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:act-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.winteraccess.id + username: aditya.prima + password: ${{ secrets.PATOKEN }} + - name: Build and push 5.6 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=5.6 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:5.6-rootless + git.winteraccess.id/${{ gitea.repository }}:5.6-ubuntu-rootless + - name: Build and push 7.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=7.2 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:7.2-rootless + git.winteraccess.id/${{ gitea.repository }}:7.2-ubuntu-rootless + - name: Build and push 7.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=7.3 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:7.3-rootless + git.winteraccess.id/${{ gitea.repository }}:7.3-ubuntu-rootless + - name: Build and push 7.4 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=7.4 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:7.4-rootless + git.winteraccess.id/${{ gitea.repository }}:7.4-ubuntu-rootless + - name: Build and push 8.0 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=8.0 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.0-rootless + git.winteraccess.id/${{ gitea.repository }}:8.0-ubuntu-rootless + - name: Build and push 8.1 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=8.1 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.1-rootless + git.winteraccess.id/${{ gitea.repository }}:8.1-ubuntu-rootless + - name: Build and push 8.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=8.2 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.2-rootless + git.winteraccess.id/${{ gitea.repository }}:8.2-ubuntu-rootless + - name: Build and push 8.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu-rootless + build-args: | + PHP_VERSION=8.3 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.3-rootless + git.winteraccess.id/${{ gitea.repository }}:8.3-ubuntu-rootless + git.winteraccess.id/${{ gitea.repository }}:latest-ubuntu-rootless + git.winteraccess.id/${{ gitea.repository }}:ubuntu-rootless + git.winteraccess.id/${{ gitea.repository }}:latest-rootless diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 604b390..a5532e7 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -25,6 +25,10 @@ ADD ./etc /etc ADD ./scripts/php-fpm-init-alpine /usr/local/bin/php-fpm-init RUN chmod +x /usr/local/bin/php-fpm-init +# INSTALL PHP FPM HEALTHCHECK UTILITIES +ADD https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck /usr/local/bin +RUN chmod +x /usr/local/bin/php-fpm-healthcheck + # CLEAN APK CACHES RUN rm -vrf /var/cache/apk/* diff --git a/Dockerfile.alpine-rootless b/Dockerfile.alpine-rootless new file mode 100644 index 0000000..5d80273 --- /dev/null +++ b/Dockerfile.alpine-rootless @@ -0,0 +1,41 @@ +ARG REGISTRY_URL=git.winteraccess.id/docker +ARG PHP_VERSION=8.3 + +FROM ${REGISTRY_URL}/php:${PHP_VERSION}-alpine +LABEL maintainer=" aprimediet@gmail.com" + +ENV PHP_FPM_BIN=php-fpm${PHP_VERSION} + +# ADD USER +RUN addgroup -g 10001 phpfpm && adduser -D -u 10001 -G phpfpm -s /bin/sh -h /app phpfpm + +# Set workdir +WORKDIR / + +# INSTALL PHP APP +RUN --mount=type=cache,target=/var/cache/apk \ + apk upgrade && apk add --update \ + php${PHP_VERSION}-fpm + +# REMOVE CURRENT POOL FIRST +RUN rm -rf /etc/php${PHP_VERSION}/php-fpm* + +# COPY CONFIGURATION FILES +RUN mkdir -p /etc/php/fpm +ADD ./etc/php/fpm/php-fpm.conf /etc/php/fpm/php-fpm.conf +ADD ./etc/php/fpm/pool.d-rootless /etc/php/fpm/pool.d + +# COPY INIT SCRIPT +ADD ./scripts/php-fpm-init-alpine /usr/local/bin/php-fpm-init +RUN chmod +x /usr/local/bin/php-fpm-init + +# INSTALL PHP FPM HEALTHCHECK UTILITIES +ADD https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck /usr/local/bin +RUN chmod +x /usr/local/bin/php-fpm-healthcheck + +# CLEAN APK CACHES +RUN rm -vrf /var/cache/apk/* + +USER phpfpm + +EXPOSE 9000 \ No newline at end of file diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 414d73d..2f55a1b 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -24,6 +24,10 @@ ADD ./etc/php/fpm /etc/php/fpm ADD ./scripts/php-fpm-init /usr/local/bin/php-fpm-init RUN chmod +x /usr/local/bin/php-fpm-init +# INSTALL PHP FPM HEALTHCHECK UTILITIES +ADD https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck /usr/local/bin +RUN chmod +x /usr/local/bin/php-fpm-healthcheck + # CLEAN APT CACHE RUN apt -y clean diff --git a/Dockerfile.ubuntu-rootless b/Dockerfile.ubuntu-rootless new file mode 100644 index 0000000..03a3fbc --- /dev/null +++ b/Dockerfile.ubuntu-rootless @@ -0,0 +1,39 @@ +ARG PHP_VERSION=8.3 +ARG REGISTRY_URL=git.winteraccess.id/docker + +FROM ${REGISTRY_URL}/php:${PHP_VERSION}-ubuntu +LABEL maintainer=" aprimediet@gmail.com" + +ENV PHP_FPM_BIN=php-fpm${PHP_VERSION} + +# ADD USER +RUN groupadd -g 10001 phpfpm && useradd -D -u 10001 -G phpfpm -s /bin/sh -h /app phpfpm + +# Set workdir +WORKDIR / + +# INSTALL BASE DEPENDENCIES +RUN --mount=type=cache,target=/var/cache/apt/archives \ + apt -y update && apt -y upgrade && apt -y install \ + php${PHP_VERSION}-fpm + +# REMOVE DEFAULT PHP FPM +RUN rm -rf /etc/php/${PHP_VERSION}/fpm + +# COPY CONFIGURATION FILES +ADD ./etc/php/fpm /etc/php/fpm + +# COPY INIT SCRIPT +ADD ./scripts/php-fpm-init /usr/local/bin/php-fpm-init +RUN chmod +x /usr/local/bin/php-fpm-init + +# INSTALL PHP FPM HEALTHCHECK UTILITIES +ADD https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck /usr/local/bin +RUN chmod +x /usr/local/bin/php-fpm-healthcheck + +# CLEAN APT CACHE +RUN apt -y clean + +USER phpfpm + +EXPOSE 9000 \ No newline at end of file diff --git a/etc/php/fpm/pool.d-rootless/00-www.conf b/etc/php/fpm/pool.d-rootless/00-www.conf new file mode 100644 index 0000000..bdb170b --- /dev/null +++ b/etc/php/fpm/pool.d-rootless/00-www.conf @@ -0,0 +1,55 @@ +[www] + +;prefix = /path/to/pools/$pool +user = phpfpm +group = phpfpm + +listen = 9000 +listen.owner = phpfpm +listen.group = phpfpm +;listen.mode = 0660 +;listen.acl_users = +;listen.acl_groups = +;listen.allowed_clients = 127.0.0.1 +; process.priority = -19 +;access.log = /proc/self/fd/2 +;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" +;slowlog = log/$pool.log.slow +;request_slowlog_timeout = 0 +;request_terminate_timeout = 0 +;rlimit_files = 1024 +;rlimit_core = 0 +;chroot = +;chdir = /var/www +;catch_workers_output = yes +clear_env = no +;security.limit_extensions = .php .php3 .php4 .php5 + +; +; WORKER SETTINGS +; COPY AND ADJUST THIS FOR DIFFERENT SCENARIO +; + +pm = dynamic +pm.max_children = 10 +pm.start_servers = 5 +pm.min_spare_servers = 5 +pm.max_spare_servers = 5 +pm.process_idle_timeout = 10s; +pm.max_requests = 500 +;pm.status_path = /status +;ping.path = /ping +;ping.response = pong + +; +; PHP.INI OVERRIDE +; COPY AND ADJUST THIS FOR DIFFERENT SCENARIO +; + +php_admin_value[memory_limit] = 128M +php_admin_value[date.timezone] = Asia/Jakarta +php_value[upload_max_filesize]=256M +php_value[post_max_size]=256M +php_value[max_execution_time]=30 +php_admin_value[output_buffering]=16384 +php_value[session.save_path]="/var/lib/php/session"