Skip to content

Commit e6040b0

Browse files
committed
PHP 8.4
1 parent 166bbd9 commit e6040b0

12 files changed

+548
-0
lines changed

.github/workflows/docker-image.yml

+34
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,37 @@ jobs:
177177
env:
178178
SHA: ${{ steps.short-sha.outputs.sha }}
179179
BRANCH: ${{ steps.extract_branch.outputs.branch }}
180+
181+
php84:
182+
183+
runs-on: ubuntu-latest
184+
185+
steps:
186+
- uses: actions/checkout@v3
187+
188+
- uses: benjlevesque/[email protected]
189+
id: short-sha
190+
with:
191+
length: 6
192+
193+
- name: Extract branch name
194+
shell: bash
195+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
196+
id: extract_branch
197+
198+
- name: Set up Docker Buildx
199+
id: buildx
200+
uses: docker/setup-buildx-action@v2
201+
202+
-
203+
name: Login to Docker Hub
204+
uses: docker/login-action@v2
205+
with:
206+
username: ${{ secrets.DOCKERHUB_USERNAME }}
207+
password: ${{ secrets.DOCKERHUB_TOKEN }}
208+
209+
- name: Build the Docker image
210+
run: ./build/build-8.4.sh
211+
env:
212+
SHA: ${{ steps.short-sha.outputs.sha }}
213+
BRANCH: ${{ steps.extract_branch.outputs.branch }}

build/build-8.4.sh

+6
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.4 -f php/Dockerfile-8.4 .
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.4-latest -f php/Dockerfile-8.4 .
6+
fi

build/build-test-image-8.4.sh

+5
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.4
5+
docker build -t prlx/k8s-openresty-php-php:build-$BUILDNUMBER-php-8.4-test -f test/Dockerfile-8.4 .

build/deploy-8.4.sh

+7
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.4.yaml
5+
kubectl --kubeconfig=$KUBERNETESCONFIG apply -f yaml-deploy/service-8.4.yaml
6+
kubectl --kubeconfig=$KUBERNETESCONFIG apply -f yaml-deploy/ingress-8.4.yaml
7+
kubectl --kubeconfig=$KUBERNETESCONFIG apply -f yaml-deploy/certificate-8.4.yaml

php/Dockerfile-8.4

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

test/Dockerfile-8.4

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

yaml-deploy/deployment-8.4.yaml

+111
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.4'
8+
name: 'k8s-openresty-php-8.4'
9+
namespace: default
10+
spec:
11+
progressDeadlineSeconds: 600
12+
replicas: 1
13+
revisionHistoryLimit: 1
14+
selector:
15+
matchLabels:
16+
app: 'k8s-openresty-php-8.4'
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.4'
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.4'
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.4.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: 'openresty-8.4'
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.4'
14+
sessionAffinity: None
15+
type: NodePort

0 commit comments

Comments
 (0)