Skip to content

Commit 5c4e327

Browse files
committed
DOI
but no entrypoint scipt - mount you own configs
1 parent 7574328 commit 5c4e327

File tree

4 files changed

+345
-2
lines changed

4 files changed

+345
-2
lines changed
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
name: 'docker: DOI + PHP-FPM'
2+
3+
on:
4+
#push:
5+
# branches:
6+
# - 'main'
7+
# - 'master'
8+
# paths:
9+
# - 'doi.alpine.fpm.wsc.Dockerfile'
10+
# - 'doi.debian.fpm.wsc.Dockerfile'
11+
# - '.github/workflows/build_docker-doi_fpm.yml'
12+
workflow_dispatch:
13+
schedule:
14+
- cron: '45 4 25 * *' # At 02:45 on day-of-month 25.
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
20+
jobs:
21+
22+
# --------------------------------------------------
23+
# JOB: PREPARE (Variables)
24+
# --------------------------------------------------
25+
prepare:
26+
name: Prepare build variables
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
#- name: Checkout
31+
# uses: actions/checkout@v6
32+
33+
- name: Define PHP matrix
34+
id: matrix
35+
shell: bash
36+
run: |
37+
echo 'php_matrix=["8.3","8.4","8.5"]' >> "$GITHUB_OUTPUT"
38+
39+
- name: Generate build variables
40+
id: vars
41+
shell: bash
42+
run: |
43+
BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
44+
BUILD_DATE_NUMERIC="${BUILD_DATE//[^[:digit:]]/}"
45+
#COMMIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
46+
COMMIT_HASH=${GITHUB_SHA::7}
47+
GIT_URL=$(echo "${GITHUB_SERVER_URL}" | awk -F/ '{print $3}' | sed 's/\/*$//')
48+
GIT_URL=$(echo "$GIT_URL" | sed 's/github\.com/ghcr\.io/g') # GIT_URL switch to ghcr.io registry for GitHub
49+
GIT_REPO=${GITHUB_REPOSITORY,,}
50+
GIT_REPO_SHORT=${GIT_REPO#*/}
51+
GIT_REPO_SHORT=${GIT_REPO_SHORT#"docker-"}
52+
DOCKER_REPO=${{ vars.DOCKER_USERNAME }}/${GIT_REPO_SHORT}
53+
REDHAT_QUAY_REPO=${{ vars.REDHAT_QUAY_USERNAME }}/${GIT_REPO_SHORT}
54+
55+
#echo "ENVs: BUILD_DATE=${BUILD_DATE}, BUILD_DATE_NUMERIC=${BUILD_DATE_NUMERIC}, COMMIT_HASH=${COMMIT_HASH}, GIT_URL=${GIT_URL}, GIT_REPO=${GIT_REPO}, DOCKER_REPO=${DOCKER_REPO}, REDHAT_QUAY_REPO=${REDHAT_QUAY_REPO}"
56+
57+
# Set output parameters to action.
58+
echo "build_date=${BUILD_DATE}" >> "$GITHUB_OUTPUT"
59+
echo "build_date_numeric=${BUILD_DATE_NUMERIC}" >> "$GITHUB_OUTPUT"
60+
echo "commit_hash=${COMMIT_HASH}" >> "$GITHUB_OUTPUT"
61+
echo "git_url=${GIT_URL}" >> "$GITHUB_OUTPUT"
62+
echo "git_repo=${GIT_REPO}" >> "$GITHUB_OUTPUT"
63+
echo "git_repo_short=${GIT_REPO_SHORT}" >> "$GITHUB_OUTPUT"
64+
echo "docker_repo=${DOCKER_REPO}" >> "$GITHUB_OUTPUT"
65+
echo "redhat_quay_repo=${REDHAT_QUAY_REPO}" >> "$GITHUB_OUTPUT"
66+
67+
outputs:
68+
build_date: ${{ steps.vars.outputs.build_date }}
69+
build_date_numeric: ${{ steps.vars.outputs.build_date_numeric }}
70+
commit_hash: ${{ steps.vars.outputs.commit_hash }}
71+
git_url: ${{ steps.vars.outputs.git_url }}
72+
git_repo: ${{ steps.vars.outputs.git_repo }}
73+
git_repo_short: ${{ steps.vars.outputs.git_repo_short }}
74+
docker_repo: ${{ steps.vars.outputs.docker_repo }}
75+
quay_repo: ${{ steps.vars.outputs.redhat_quay_repo }}
76+
php_matrix: ${{ steps.matrix.outputs.php_matrix }}
77+
78+
79+
# --------------------------------------------------
80+
# JOB: DOI Alpine PHP-FPM WSC
81+
# --------------------------------------------------
82+
build-doi-alpine-fpm-wsc:
83+
name: Build doi Alpine FPM WSC (PHP ${{ matrix.php }})
84+
runs-on: ubuntu-latest
85+
needs: prepare
86+
87+
strategy:
88+
fail-fast: false
89+
matrix:
90+
php: ${{ fromJson(needs.prepare.outputs.php_matrix) }}
91+
92+
env:
93+
BUILD_DATE: ${{ needs.prepare.outputs.build_date }}
94+
BUILD_DATE_NUMERIC: ${{ needs.prepare.outputs.build_date_numeric}}
95+
COMMIT_HASH: ${{ needs.prepare.outputs.commit_hash }}
96+
GIT_URL: ${{ needs.prepare.outputs.git_url }}
97+
GIT_REPO: ${{ needs.prepare.outputs.git_repo }}
98+
GIT_REPO_SHORT: ${{ needs.prepare.outputs.git_repo_short }}
99+
DOCKER_REPO: ${{ needs.prepare.outputs.docker_repo }}
100+
QUAY_REPO: ${{ needs.prepare.outputs.quay_repo }}
101+
PHP_VERSION: ${{ matrix.php }}
102+
103+
steps:
104+
- name: Checkout
105+
uses: actions/checkout@v6
106+
107+
- name: Debug Variables
108+
run: |
109+
echo "BUILD_DATE=${BUILD_DATE}"
110+
echo "BUILD_DATE_NUMERIC=${BUILD_DATE_NUMERIC}"
111+
echo "COMMIT_HASH=${COMMIT_HASH}"
112+
echo "GIT_URL=${GIT_URL}"
113+
echo "GIT_REPO=${GIT_REPO}"
114+
echo "GIT_REPO_SHORT=${GIT_REPO_SHORT}"
115+
echo "DOCKER_REPO=${DOCKER_REPO}"
116+
echo "QUAY_REPO=${QUAY_REPO}"
117+
echo "PHP_VERSION=${PHP_VERSION}"
118+
119+
- name: Execute Docker Setup
120+
id: docker-setup
121+
uses: ./.github/actions/docker-setup
122+
#uses: tob1as/docker-build-example/.github/actions/docker-setup@main
123+
with:
124+
git_url: ${{ env.GIT_URL }}
125+
git_username: ${{ github.repository_owner }}
126+
git_token: ${{ secrets.GITHUB_TOKEN }}
127+
docker_username: ${{ vars.DOCKER_USERNAME }}
128+
docker_password: ${{ secrets.DOCKER_PASSWORD }}
129+
quay_username: ${{ vars.REDHAT_QUAY_USERNAME }}
130+
quay_password: ${{ secrets.REDHAT_QUAY_PASSWORD }}
131+
132+
- name: Build
133+
uses: docker/build-push-action@v6
134+
with:
135+
builder: ${{ steps.docker-setup.outputs.builder_name }}
136+
context: .
137+
file: ./doi.alpine.fpm.wsc.Dockerfile
138+
platforms: linux/amd64,linux/arm64
139+
pull: true
140+
push: true
141+
target: production
142+
build-args: |
143+
BUILD_DATE=${{ env.BUILD_DATE }}
144+
VCS_REF=${{ env.COMMIT_HASH }}
145+
PHP_VERSION=${{ env.PHP_VERSION }}
146+
tags: |
147+
docker.io/${{env.DOCKER_REPO}}:${{env.PHP_VERSION}}-doi-fpm-alpine-wsc
148+
docker.io/${{env.DOCKER_REPO}}:${{env.PHP_VERSION}}-doi-fpm-alpine-wsc-${{env.COMMIT_HASH}}
149+
# ${{env.GIT_URL}}/${{env.GIT_REPO}}:${{env.PHP_VERSION}}-doi-fpm-alpine-wsc
150+
# quay.io/${{env.QUAY_REPO}}:${{env.PHP_VERSION}}-doi-fpm-alpine-wsc
151+
152+
153+
154+
# --------------------------------------------------
155+
# JOB: DOI Debian PHP-FPM WSC
156+
# --------------------------------------------------
157+
build-doi-debian-fpm-wsc:
158+
name: Build doi Debian FPM WSC (PHP ${{ matrix.php }})
159+
runs-on: ubuntu-latest
160+
needs: prepare
161+
162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
php: ${{ fromJson(needs.prepare.outputs.php_matrix) }}
166+
167+
env:
168+
BUILD_DATE: ${{ needs.prepare.outputs.build_date }}
169+
BUILD_DATE_NUMERIC: ${{ needs.prepare.outputs.build_date_numeric}}
170+
COMMIT_HASH: ${{ needs.prepare.outputs.commit_hash }}
171+
GIT_URL: ${{ needs.prepare.outputs.git_url }}
172+
GIT_REPO: ${{ needs.prepare.outputs.git_repo }}
173+
GIT_REPO_SHORT: ${{ needs.prepare.outputs.git_repo_short }}
174+
DOCKER_REPO: ${{ needs.prepare.outputs.docker_repo }}
175+
QUAY_REPO: ${{ needs.prepare.outputs.quay_repo }}
176+
PHP_VERSION: ${{ matrix.php }}
177+
178+
steps:
179+
- name: Checkout
180+
uses: actions/checkout@v6
181+
182+
- name: Debug Variables
183+
run: |
184+
echo "BUILD_DATE=${BUILD_DATE}"
185+
echo "BUILD_DATE_NUMERIC=${BUILD_DATE_NUMERIC}"
186+
echo "COMMIT_HASH=${COMMIT_HASH}"
187+
echo "GIT_URL=${GIT_URL}"
188+
echo "GIT_REPO=${GIT_REPO}"
189+
echo "GIT_REPO_SHORT=${GIT_REPO_SHORT}"
190+
echo "DOCKER_REPO=${DOCKER_REPO}"
191+
echo "QUAY_REPO=${QUAY_REPO}"
192+
echo "PHP_VERSION=${PHP_VERSION}"
193+
194+
- name: Execute Docker Setup
195+
id: docker-setup
196+
uses: ./.github/actions/docker-setup
197+
#uses: tob1as/docker-build-example/.github/actions/docker-setup@main
198+
with:
199+
git_url: ${{ env.GIT_URL }}
200+
git_username: ${{ github.repository_owner }}
201+
git_token: ${{ secrets.GITHUB_TOKEN }}
202+
docker_username: ${{ vars.DOCKER_USERNAME }}
203+
docker_password: ${{ secrets.DOCKER_PASSWORD }}
204+
quay_username: ${{ vars.REDHAT_QUAY_USERNAME }}
205+
quay_password: ${{ secrets.REDHAT_QUAY_PASSWORD }}
206+
207+
- name: Build
208+
uses: docker/build-push-action@v6
209+
with:
210+
builder: ${{ steps.docker-setup.outputs.builder_name }}
211+
context: .
212+
file: ./doi.debian.fpm.wsc.Dockerfile
213+
platforms: linux/amd64,linux/arm64
214+
pull: true
215+
push: true
216+
target: production
217+
build-args: |
218+
BUILD_DATE=${{ env.BUILD_DATE }}
219+
VCS_REF=${{ env.COMMIT_HASH }}
220+
PHP_VERSION=${{ env.PHP_VERSION }}
221+
tags: |
222+
docker.io/${{env.DOCKER_REPO}}:${{env.PHP_VERSION}}-doi-fpm-debian-wsc
223+
docker.io/${{env.DOCKER_REPO}}:${{env.PHP_VERSION}}-doi-fpm-debian-wsc-${{env.COMMIT_HASH}}
224+
# ${{env.GIT_URL}}/${{env.GIT_REPO}}:${{env.PHP_VERSION}}-doi-fpm-debian-wsc
225+
# quay.io/${{env.QUAY_REPO}}:${{env.PHP_VERSION}}-doi-fpm-debian-wsc

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PHP is a server-side scripting language designed for web development, but which
3131
![logo](https://raw.githubusercontent.com/docker-library/docs/master/php/logo.png)
3232

3333
### About these images:
34-
* based on official images: [DockerHub](https://hub.docker.com/_/php/) / [GitHub](https://github.com/docker-library/php)
34+
* based on Docker Official Images (DOI): [DockerHub](https://hub.docker.com/_/php/) / [GitHub](https://github.com/docker-library/php)
3535
* The official base Images have the following PHP extensions enabled by default (check with: ```php -m```): ```Core ctype curl date dom fileinfo filter hash iconv json libxml mbstring mysqlnd openssl pcre PDO pdo_sqlite Phar posix random readline Reflection session SimpleXML sodium SPL sqlite3 standard tokenizer xml xmlreader xmlwriter 'Zend OPcache' zlib```
3636
* These images extend the basic images with additional PHP extensions, for example: SQL-Databases, gd, imagick, ldap and more. For details see in dockerfiles.
3737
* *Images with `-slim` suffix have only the PHP extensions like offical base image, but with entrypoint script for some settings and other adjustments. This is the base image for all others.*
@@ -40,7 +40,8 @@ PHP is a server-side scripting language designed for web development, but which
4040
* *Images with `-extended` suffix at present only for php images with nginx. (Prometheus Exporter and other)*
4141
* *Images containing `apache` or `nginx` are integrated with the web server.*
4242
* *Images containing `debian` or `alpine` specify the operating system.*
43-
* *Images containing `dhi` based on [DHI (Docker Hardened Images)](https://dhi.io/catalog/php) and not based on offical images from community. This DHI do not have a shell and therefore NO entrypoint script. The environment variables listed in the README therefore do not work here. Mount your configuration file(s). A example docker-compose setup you can find [here](https://github.com/Tob1as/docker-php/tree/master/examples/fpm-nginx-dhi).*
43+
* *Images containing `doi` based on [DOI (Docker Official Images)](https://github.com/docker-library/php) like the other images in this repository, but without an entrypoint script, so the environment variables from this README are not supported. Mount your configuration file(s)
44+
* *Images containing `dhi` based on [DHI (Docker Hardened Images)](https://dhi.io/catalog/php) and NOT based on Docker Offical Images (from Community). This DHI do not have a shell and therefore NO entrypoint script. The environment variables listed in the README therefore do not supported here. Mount your configuration file(s). A example docker-compose setup you can find [here](https://github.com/Tob1as/docker-php/tree/master/examples/fpm-nginx-dhi).*
4445
* For easy install the extensions and get a smaller images it use [php-extension-installer](https://github.com/mlocati/docker-php-extension-installer).
4546
* For information about PHP and extensions see here: [php.net](https://php.net) and [pecl.php.net](https://pecl.php.net).
4647

doi.alpine.fpm.wsc.Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# build: docker build --no-cache --progress=plain --build-arg PHP_VERSION=8.4 -t docker.io/tobi312/php:8.4-doi-fpm-alpine-wsc -f doi.alpine.fpm.wsc.Dockerfile .
2+
# check: docker run --rm --name phptest -it docker.io/tobi312/php:8.4-doi-fpm-alpine-wsc -m
3+
ARG PHP_VERSION=8.4
4+
ARG BUILD_PHP_VERSION=${PHP_VERSION}
5+
FROM php:${BUILD_PHP_VERSION}-fpm-alpine
6+
ARG BUILD_PHP_VERSION
7+
8+
ARG VCS_REF
9+
ARG BUILD_DATE
10+
11+
LABEL org.opencontainers.image.authors="Tobias Hargesheimer <docker@ison.ws>" \
12+
org.opencontainers.image.title="DOI PHP-FPM for WSC" \
13+
org.opencontainers.image.description="DOI (Docker Official Images): Alpine with PHP-FPM ${BUILD_PHP_VERSION} for WSC (WoltLab Suite Core)" \
14+
org.opencontainers.image.created="${BUILD_DATE}" \
15+
org.opencontainers.image.revision="${VCS_REF}" \
16+
org.opencontainers.image.licenses="MIT" \
17+
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/php" \
18+
org.opencontainers.image.source="https://github.com/Tob1as/docker-php"
19+
20+
# WSC = WoltLab Suite Core <https://www.woltlab.com/en/>
21+
# PHP Extensions Requirements:
22+
# - https://manual.woltlab.com/en/requirements/#php-extensions
23+
# - https://manual.woltlab.com/en/elasticsearch/#system-requirements
24+
# - https://manual.woltlab.com/en/ldap/#system-requirements
25+
# Note: Some PHP Extensions/Modules are installed by default, so these have been commented out.
26+
27+
RUN \
28+
PHP_EXTENSION_INSTALLER_VERSION=$(curl -s https://api.github.com/repos/mlocati/docker-php-extension-installer/releases/latest | grep 'tag_name' | cut -d '"' -f4) ; \
29+
echo "install-php-extensions Version: ${PHP_EXTENSION_INSTALLER_VERSION}" ; \
30+
curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/download/${PHP_EXTENSION_INSTALLER_VERSION}/install-php-extensions -o /usr/local/bin/install-php-extensions ; \
31+
chmod +x /usr/local/bin/install-php-extensions ; \
32+
PHP_EXTENSIONS_LIST=" \
33+
# ctype \
34+
# curl \
35+
# dom \
36+
exif \
37+
gd \
38+
gmp \
39+
imagick \
40+
intl \
41+
ldap \
42+
# libxml \
43+
# mbstring \
44+
# openssl \
45+
# opcache \
46+
# PDO \
47+
pdo_mysql \
48+
redis \
49+
# zlib \
50+
" ; \
51+
install-php-extensions $PHP_EXTENSIONS_LIST ; \
52+
php -m ; \
53+
apk --no-cache add \
54+
tzdata \
55+
fcgi \
56+
; \
57+
cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini

doi.debian.fpm.wsc.Dockerfile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# build: docker build --no-cache --progress=plain --build-arg PHP_VERSION=8.4 -t docker.io/tobi312/php:8.4-doi-fpm-debian-wsc -f doi.debian.fpm.wsc.Dockerfile .
2+
# check: docker run --rm --name phptest -it docker.io/tobi312/php:8.4-doi-fpm-debian-wsc -m
3+
ARG PHP_VERSION=8.4
4+
ARG BUILD_PHP_VERSION=${PHP_VERSION}
5+
FROM php:${BUILD_PHP_VERSION}-fpm
6+
ARG BUILD_PHP_VERSION
7+
8+
ARG VCS_REF
9+
ARG BUILD_DATE
10+
11+
LABEL org.opencontainers.image.authors="Tobias Hargesheimer <docker@ison.ws>" \
12+
org.opencontainers.image.title="DOI PHP-FPM for WSC" \
13+
org.opencontainers.image.description="DOI (Docker Official Images): Debian with PHP-FPM ${BUILD_PHP_VERSION} for WSC (WoltLab Suite Core)" \
14+
org.opencontainers.image.created="${BUILD_DATE}" \
15+
org.opencontainers.image.revision="${VCS_REF}" \
16+
org.opencontainers.image.licenses="MIT" \
17+
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/php" \
18+
org.opencontainers.image.source="https://github.com/Tob1as/docker-php"
19+
20+
# WSC = WoltLab Suite Core <https://www.woltlab.com/en/>
21+
# PHP Extensions Requirements:
22+
# - https://manual.woltlab.com/en/requirements/#php-extensions
23+
# - https://manual.woltlab.com/en/elasticsearch/#system-requirements
24+
# - https://manual.woltlab.com/en/ldap/#system-requirements
25+
# Note: Some PHP Extensions/Modules are installed by default, so these have been commented out.
26+
27+
RUN \
28+
PHP_EXTENSION_INSTALLER_VERSION=$(curl -s https://api.github.com/repos/mlocati/docker-php-extension-installer/releases/latest | grep 'tag_name' | cut -d '"' -f4) ; \
29+
echo "install-php-extensions Version: ${PHP_EXTENSION_INSTALLER_VERSION}" ; \
30+
curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/download/${PHP_EXTENSION_INSTALLER_VERSION}/install-php-extensions -o /usr/local/bin/install-php-extensions ; \
31+
chmod +x /usr/local/bin/install-php-extensions ; \
32+
PHP_EXTENSIONS_LIST=" \
33+
# ctype \
34+
# curl \
35+
# dom \
36+
exif \
37+
gd \
38+
gmp \
39+
imagick \
40+
intl \
41+
ldap \
42+
# libxml \
43+
# mbstring \
44+
# openssl \
45+
# opcache \
46+
# PDO \
47+
pdo_mysql \
48+
redis \
49+
# zlib \
50+
" ; \
51+
install-php-extensions $PHP_EXTENSIONS_LIST ; \
52+
php -m ; \
53+
RUN apt-get update; \
54+
apt-get install -y --no-install-recommends \
55+
wget \
56+
netcat-openbsd \
57+
libfcgi-bin \
58+
; \
59+
rm -rf /var/lib/apt/lists/* ; \
60+
cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini

0 commit comments

Comments
 (0)