Skip to content

Commit c88bf01

Browse files
committed
Finish up CI
1 parent fd09f3e commit c88bf01

File tree

7 files changed

+319
-21
lines changed

7 files changed

+319
-21
lines changed

.github/workflows/docker-image.yml

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,108 @@
11
name: Docker Image CI
22

3-
on:
4-
push:
5-
branches: [ master ]
3+
on: push
64

75
jobs:
8-
build:
6+
php74:
97

108
runs-on: ubuntu-latest
119

1210
steps:
1311
- uses: actions/checkout@v3
12+
13+
- uses: benjlevesque/[email protected]
14+
id: short-sha
15+
with:
16+
length: 6
17+
18+
- name: Extract branch name
19+
shell: bash
20+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
21+
id: extract_branch
22+
23+
- name: Set up Docker Buildx
24+
id: buildx
25+
uses: docker/setup-buildx-action@v2
26+
27+
-
28+
name: Login to Docker Hub
29+
uses: docker/login-action@v2
30+
with:
31+
username: ${{ secrets.DOCKERHUB_USERNAME }}
32+
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
34+
- name: Build the Docker image
35+
run: ./build/build-7.4.sh
36+
env:
37+
SHA: ${{ steps.short-sha.outputs.sha }}
38+
BRANCH: ${{ steps.extract_branch.outputs.branch }}
39+
40+
41+
php80:
42+
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@v3
47+
48+
- uses: benjlevesque/[email protected]
49+
id: short-sha
50+
with:
51+
length: 6
52+
53+
- name: Extract branch name
54+
shell: bash
55+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
56+
id: extract_branch
57+
1458
- name: Set up Docker Buildx
1559
id: buildx
1660
uses: docker/setup-buildx-action@v2
61+
62+
-
63+
name: Login to Docker Hub
64+
uses: docker/login-action@v2
65+
with:
66+
username: ${{ secrets.DOCKERHUB_USERNAME }}
67+
password: ${{ secrets.DOCKERHUB_TOKEN }}
68+
69+
- name: Build the Docker image
70+
run: ./build/build-8.0.sh
71+
env:
72+
SHA: ${{ steps.short-sha.outputs.sha }}
73+
BRANCH: ${{ steps.extract_branch.outputs.branch }}
74+
75+
76+
php81:
77+
78+
runs-on: ubuntu-latest
79+
80+
steps:
81+
- uses: actions/checkout@v3
82+
83+
- uses: benjlevesque/[email protected]
84+
id: short-sha
85+
with:
86+
length: 6
87+
88+
- name: Extract branch name
89+
shell: bash
90+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
91+
id: extract_branch
92+
93+
- name: Set up Docker Buildx
94+
id: buildx
95+
uses: docker/setup-buildx-action@v2
96+
97+
-
98+
name: Login to Docker Hub
99+
uses: docker/login-action@v2
100+
with:
101+
username: ${{ secrets.DOCKERHUB_USERNAME }}
102+
password: ${{ secrets.DOCKERHUB_TOKEN }}
103+
17104
- name: Build the Docker image
18105
run: ./build/build-8.1.sh
106+
env:
107+
SHA: ${{ steps.short-sha.outputs.sha }}
108+
BRANCH: ${{ steps.extract_branch.outputs.branch }}

build/build-7.4.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
2-
# Used to build and deploy to minikube for local dev
2+
docker buildx build --push --platform=linux/arm64/v8,linux/amd64 -t prlx/k8s-openresty-php-php:build-$SHA-php-7.4 -f php/Dockerfile-7.4 .
33

4-
BUILDNUMBER=$bamboo_buildNumber
5-
6-
# PHP
7-
docker buildx build --push --platform=linux/arm64/v8,linux/amd64 -t prlx/k8s-openresty-php-php:build-$BUILDNUMBER-php-7.4 -f php/Dockerfile-7.4 .
4+
if [ "$BRANCH" == 'master' ]; then
5+
docker buildx build --push --platform=linux/arm64/v8,linux/amd64 -t prlx/k8s-openresty-php-php:release-php-7.4-latest -f php/Dockerfile-7.4 .
6+
fi

build/build-8.0.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
2-
# Used to build and deploy to minikube for local dev
2+
docker buildx build --push --platform=linux/arm64/v8,linux/amd64 -t prlx/k8s-openresty-php-php:build-$SHA-php-8.0 -f php/Dockerfile-8.0 .
33

4-
BUILDNUMBER=$bamboo_buildNumber
5-
6-
# PHP
7-
docker buildx build --push --platform=linux/arm64/v8,linux/amd64 -t prlx/k8s-openresty-php-php:build-$BUILDNUMBER-php-8.0 -f php/Dockerfile-8.0 .
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.0-latest -f php/Dockerfile-8.0 .
6+
fi

build/build-8.1.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
2-
# Used to build and deploy to minikube for local dev
2+
docker buildx build --push --platform=linux/arm64/v8,linux/amd64 -t prlx/k8s-openresty-php-php:build-$SHA-php-8.1 -f php/Dockerfile-8.1 .
33

4-
BUILDNUMBER=$bamboo_buildNumber
5-
6-
# PHP
7-
docker buildx build --push --platform=linux/arm64/v8,linux/amd64 -t prlx/k8s-openresty-php-php:build-$BUILDNUMBER-php-8.1 -f php/Dockerfile-8.1 .
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.1-latest -f php/Dockerfile-8.1 .
6+
fi

php/Dockerfile-7.3

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

php/Dockerfile-8.0

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.14
1+
FROM alpine:3.16
22

33
ARG ATATUS_VERSION=1.14.0
44
ARG ATATUS_ENABLED=TRUE

php/Dockerfile-8.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:edge
1+
FROM alpine:3.16
22

33
ARG ATATUS_VERSION=1.14.0
44
ARG ATATUS_ENABLED=TRUE

0 commit comments

Comments
 (0)