Skip to content

Commit b64ad6a

Browse files
committed
PHP 8.3
1 parent ccf6cf6 commit b64ad6a

16 files changed

+545
-0
lines changed

.github/workflows/docker-image.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,37 @@ jobs:
143143
env:
144144
SHA: ${{ steps.short-sha.outputs.sha }}
145145
BRANCH: ${{ steps.extract_branch.outputs.branch }}
146+
147+
php83:
148+
149+
runs-on: ubuntu-latest
150+
151+
steps:
152+
- uses: actions/checkout@v3
153+
154+
- uses: benjlevesque/[email protected]
155+
id: short-sha
156+
with:
157+
length: 6
158+
159+
- name: Extract branch name
160+
shell: bash
161+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
162+
id: extract_branch
163+
164+
- name: Set up Docker Buildx
165+
id: buildx
166+
uses: docker/setup-buildx-action@v2
167+
168+
-
169+
name: Login to Docker Hub
170+
uses: docker/login-action@v2
171+
with:
172+
username: ${{ secrets.DOCKERHUB_USERNAME }}
173+
password: ${{ secrets.DOCKERHUB_TOKEN }}
174+
175+
- name: Build the Docker image
176+
run: ./build/build-8.3.sh
177+
env:
178+
SHA: ${{ steps.short-sha.outputs.sha }}
179+
BRANCH: ${{ steps.extract_branch.outputs.branch }}

build/build-8.3.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
docker buildx build --push --platform=linux/arm64/v8,linux/amd64 -t prlx/k8s-openresty-php-php:build-$SHA-php-8.3 -f php/Dockerfile-8.3 .
3+
4+
if [ "$BRANCH" == 'master' ]; then
5+
docker buildx build --push --platform=linux/arm64/v8,linux/amd64 -t prlx/k8s-openresty-php-php:release-php-8.3-latest -f php/Dockerfile-8.3 .
6+
fi

build/build-test-image-7.4.sh

100644100755
File mode changed.

build/build-test-image-8.0.sh

100644100755
File mode changed.

build/build-test-image-8.3.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
BUILDNUMBER=$bamboo_buildNumber
3+
4+
sed -i -e "s#{{ BUILDNUMBER }}#$BUILDNUMBER#g" test/Dockerfile-8.3
5+
docker build -t prlx/k8s-openresty-php-php:build-$BUILDNUMBER-php-8.3-test -f test/Dockerfile-8.3 .

build/deploy-7.4.sh

100644100755
File mode changed.

build/deploy-8.0.sh

100644100755
File mode changed.

build/deploy-8.3.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
# Apply to Kubernetes
3+
kubectl --kubeconfig=$KUBERNETESCONFIG apply -f yaml-deploy/namespace.yaml
4+
kubectl --kubeconfig=$KUBERNETESCONFIG apply -f yaml-deploy/deployment-8.3.yaml
5+
kubectl --kubeconfig=$KUBERNETESCONFIG apply -f yaml-deploy/service-8.3.yaml
6+
kubectl --kubeconfig=$KUBERNETESCONFIG apply -f yaml-deploy/ingress-8.3.yaml
7+
kubectl --kubeconfig=$KUBERNETESCONFIG apply -f yaml-deploy/certificate-8.3.yaml

php/Dockerfile-8.3

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
FROM alpine:3.19
2+
3+
ARG ATATUS_VERSION=1.15.0
4+
ARG ATATUS_ENABLED=FALSE
5+
6+
ENV \
7+
# When using Composer, disable the warning about running commands as root/super user
8+
COMPOSER_ALLOW_SUPERUSER=1 \
9+
# Persistent runtime dependencies
10+
DEPS="php83 \
11+
php83-common \
12+
php83-curl \
13+
php83-dom \
14+
php83-exif \
15+
php83-fileinfo \
16+
php83-ftp \
17+
php83-gd \
18+
php83-iconv \
19+
php83-mysqli \
20+
php83-openssl \
21+
php83-pdo \
22+
php83-posix \
23+
php83-soap \
24+
php83-zip \
25+
php83-ldap \
26+
php83-bcmath \
27+
php83-calendar \
28+
php83-gettext \
29+
php83-mbstring \
30+
php83-pcntl \
31+
php83-phar \
32+
php83-simplexml \
33+
php83-sockets \
34+
php83-tokenizer \
35+
php83-xmlreader \
36+
php83-zip \
37+
php83-zlib \
38+
php83-xsl \
39+
php83-opcache \
40+
php83-ctype \
41+
php83-pdo_mysql \
42+
php83-pdo_sqlite \
43+
php83-sqlite3 \
44+
php83-intl \
45+
php83-fpm \
46+
php83-mysqli \
47+
php83-sodium \
48+
curl \
49+
ca-certificates \
50+
supervisor \
51+
bash \
52+
tzdata \
53+
openssl \
54+
wget \
55+
curl \
56+
bash"
57+
58+
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
59+
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories
60+
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories
61+
62+
# Install deps
63+
RUN apk add --no-cache \
64+
curl \
65+
ca-certificates \
66+
supervisor \
67+
bash \
68+
tzdata \
69+
openssl \
70+
wget \
71+
curl \
72+
bash \
73+
fcgi \
74+
nano \
75+
tidyhtml \
76+
php83 \
77+
php83-pecl-apcu \
78+
php83-bz2 \
79+
php83-common \
80+
php83-curl \
81+
php83-dom \
82+
php83-exif \
83+
php83-fileinfo \
84+
php83-ftp \
85+
php83-gd \
86+
php83-iconv \
87+
php83-pecl-imagick \
88+
php83-mbstring \
89+
php83-mysqli \
90+
php83-openssl \
91+
php83-pdo \
92+
php83-posix \
93+
php83-soap \
94+
php83-session \
95+
php83-pecl-redis \
96+
php83-zip \
97+
php83-ldap \
98+
php83-bcmath \
99+
php83-calendar \
100+
php83-gettext \
101+
php83-pcntl \
102+
php83-phar \
103+
php83-simplexml \
104+
php83-shmop \
105+
php83-sysvmsg \
106+
php83-sysvsem \
107+
php83-sysvshm \
108+
php83-sockets \
109+
php83-tidy \
110+
php83-tokenizer \
111+
php83-xmlreader \
112+
php83-zip \
113+
php83-zlib \
114+
php83-xsl \
115+
php83-xml \
116+
php83-xmlwriter \
117+
php83-opcache \
118+
php83-ctype \
119+
php83-pdo_mysql \
120+
php83-pdo_sqlite \
121+
php83-sqlite3 \
122+
php83-intl \
123+
php83-fpm \
124+
php83-mysqli \
125+
php83-sodium && \
126+
127+
ln -snf /usr/bin/php83 /usr/bin/php && \
128+
ln -snf /usr/sbin/php-fpm83 /usr/sbin/php-fpm && \
129+
130+
# Symlink current version
131+
mkdir /etc/php && \
132+
ln -snf /etc/php83 /etc/php/current;
133+
134+
# Composer
135+
RUN EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)" && \
136+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
137+
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" && \
138+
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; \
139+
then \
140+
>&2 echo 'ERROR: Invalid installer signature' \
141+
rm composer-setup.php \
142+
exit 1; \
143+
fi && \
144+
php composer-setup.php --quiet --install-dir=/usr/local/bin --filename=composer && \
145+
RESULT=$? && \
146+
rm composer-setup.php && \
147+
exit $RESULT
148+
149+
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
150+
&& architecture=$(case $(uname -m) in i386 | i686 | x86) echo "i386" ;; x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
151+
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/alpine/$architecture/$version \
152+
&& mkdir -p /tmp/blackfire \
153+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
154+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
155+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
156+
157+
RUN if [ "$ATATUS_ENABLED" == "TRUE" ]; then \
158+
# Atatus
159+
architecture=$(case $(uname -m) in i386 | i686 | x86) echo "i386" ;; x86_64 | amd64) echo "x64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "x64" ;; esac) && \
160+
wget https://s3.amazonaws.com/atatus-artifacts/atatus-php/downloads/atatus-php-$ATATUS_VERSION-$architecture-musl.tar.gz && tar -xzvf atatus-php-$ATATUS_VERSION-$architecture-musl.tar.gz && cd atatus-php-$ATATUS_VERSION-$architecture-musl && ./install.sh && rm -f /atatus-php-$ATATUS_VERSION-$architecture-musl.tar.gz && rm -rf /atatus-php-$ATATUS_VERSION-$architecture-musl && \
161+
sed -i -e 's#atatus.trace.response_time = 2000#atatus.trace.response_time = 1500#g' /etc/php/current/conf.d/atatus.ini && \
162+
sed -i -e 's#atatus.collector.pidfile = "/var/run/atatus-php-collector.pid"#atatus.collector.pidfile = "/run/atatus-php-collector.pid"#g' /etc/php/current/conf.d/atatus.ini && \
163+
sed -i -e 's#atatus.collector.connection = "/tmp/.atatus.sock"#atatus.collector.connection = "/run/atatus.sock"#g' /etc/php/current/conf.d/atatus.ini && \
164+
# Write log files to stdout
165+
rm -f /var/log/atatus/agent.log && rm -f /var/log/atatus/collector.log && rm -f /var/log/atatus/debug.txt && ln -sf /dev/null /var/log/atatus/agent.log && ln -sf /dev/null /var/log/atatus/collector.log && ln -sf /dev/null /var/log/atatus/debug.txt; \
166+
fi
167+
168+
# PHP Config
169+
ADD /php/conf/php-fpm.conf /etc/php/current/php-fpm.conf
170+
ADD /php/conf/php.ini /etc/php/current/php.ini
171+
ADD /php/conf/php-www.conf /etc/php/current/php-fpm.d/www.conf
172+
173+
# Clear out garbage
174+
RUN unset DEPS && rm -rf /run/php && rm -rf /run/php-fpm8.3
175+
176+
# Start script
177+
ADD /php/scripts/start.sh /start.sh
178+
RUN chmod +x /start.sh
179+
180+
# Start cron script
181+
ADD /php/scripts/start-cron.sh /start-cron.sh
182+
RUN chmod +x /start-cron.sh
183+
184+
# Start worker script
185+
ADD /php/scripts/start-worker.sh /start-worker.sh
186+
RUN chmod +x /start-worker.sh
187+
188+
# Configure script
189+
ADD /php/scripts/configure.sh /configure.sh
190+
RUN chmod +x /configure.sh
191+
192+
# Healthcheck script
193+
ADD /php/scripts/healthcheck.sh /healthcheck.sh
194+
RUN chmod +x /healthcheck.sh
195+
196+
CMD ["/start.sh"]

test/Dockerfile-8.3

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM prlx/k8s-openresty-php-php:build-{{ BUILDNUMBER }}-php-8.3
2+
3+
ADD test/public /src/public

yaml-deploy/deployment-8.3.yaml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
annotations:
5+
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
6+
labels:
7+
app: 'k8s-openresty-php-8.3'
8+
name: 'k8s-openresty-php-8.3'
9+
namespace: default
10+
spec:
11+
progressDeadlineSeconds: 600
12+
replicas: 1
13+
revisionHistoryLimit: 1
14+
selector:
15+
matchLabels:
16+
app: 'k8s-openresty-php-8.3'
17+
strategy:
18+
rollingUpdate:
19+
maxSurge: 1
20+
maxUnavailable: 0
21+
type: RollingUpdate
22+
template:
23+
metadata:
24+
annotations:
25+
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
26+
labels:
27+
app: 'k8s-openresty-php-8.3'
28+
spec:
29+
volumes:
30+
- name: shared-files
31+
emptyDir: {}
32+
- name: run
33+
emptyDir: {}
34+
containers:
35+
- name: openresty
36+
image: '{{ OPENRESTYIMAGEHERE }}'
37+
imagePullPolicy: IfNotPresent
38+
livenessProbe:
39+
failureThreshold: 3
40+
httpGet:
41+
path: /healthz
42+
port: nginx
43+
scheme: HTTP
44+
initialDelaySeconds: 10
45+
periodSeconds: 10
46+
successThreshold: 1
47+
timeoutSeconds: 1
48+
readinessProbe:
49+
failureThreshold: 3
50+
httpGet:
51+
path: /healthz
52+
port: nginx
53+
scheme: HTTP
54+
initialDelaySeconds: 10
55+
periodSeconds: 5
56+
successThreshold: 2
57+
timeoutSeconds: 2
58+
ports:
59+
- containerPort: 80
60+
name: openresty
61+
protocol: TCP
62+
resources:
63+
limits:
64+
cpu: "1"
65+
memory: 1100Mi
66+
requests:
67+
cpu: 50m
68+
memory: 64Mi
69+
volumeMounts:
70+
- name: shared-files
71+
mountPath: /src-shared
72+
- name: run
73+
mountPath: /run
74+
- name: php
75+
image: 'lawrencedudley/k8s-openresty-php-php:-8.3'
76+
imagePullPolicy: IfNotPresent
77+
#livenessProbe:
78+
# failureThreshold: 3
79+
# httpGet:
80+
# path: /healthz
81+
# port: nginx
82+
# scheme: HTTP
83+
# initialDelaySeconds: 10
84+
# periodSeconds: 10
85+
# successThreshold: 1
86+
# timeoutSeconds: 1
87+
#readinessProbe:
88+
# failureThreshold: 3
89+
# httpGet:
90+
# path: /healthz
91+
# port: nginx
92+
# scheme: HTTP
93+
# initialDelaySeconds: 10
94+
# periodSeconds: 5
95+
# successThreshold: 2
96+
# timeoutSeconds: 2
97+
resources:
98+
limits:
99+
cpu: "1"
100+
memory: 1100Mi
101+
requests:
102+
cpu: 50m
103+
memory: 64Mi
104+
volumeMounts:
105+
- name: shared-files
106+
mountPath: /src-shared
107+
- name: run
108+
mountPath: /run
109+
dnsPolicy: ClusterFirst
110+
restartPolicy: Always
111+
terminationGracePeriodSeconds: 20

yaml-deploy/service-8.3.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: 'openresty-8.3'
5+
namespace: default
6+
spec:
7+
ports:
8+
- name: openresty
9+
port: 80
10+
protocol: TCP
11+
targetPort: 80
12+
selector:
13+
app: 'k8s-openresty-php-8.3'
14+
sessionAffinity: None
15+
type: NodePort

0 commit comments

Comments
 (0)