Skip to content

Commit 0c2f2c7

Browse files
committed
Towards multi-arch images support
- Add environment variable to allow scripts to make decissions. - Remove x86 harcoded dependency. - Disable sqlsrv and oracle drivers for non amd64 builds (they need research). With these changes it's possible to build both amd64 and arm64 images. Need this is place to continue testing the new multi-arch automated builders from GHA (that will replace DockerHub builds, because, amazingly, they don't support multi-arch yet). Once built the multi-arch images, we'll be pushing them both to DockerHub and also to GH own registry.
1 parent a2a6e6c commit 0c2f2c7

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
FROM php:8.0-apache-buster
22

3+
# So we can use it anywhere for conditional stuff. Keeping BC with old (non-buildkit, builders)
4+
ARG TARGETPLATFORM
5+
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
6+
RUN echo "Building for ${TARGETPLATFORM}"
7+
38
ADD root/ /
49
# Fix the original permissions of /tmp, the PHP default upload tmp dir.
510
RUN chmod 777 /tmp && chmod +t /tmp

root/tmp/setup/oci8-extension.sh

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -e
44

5+
if [[ ${TARGETPLATFORM} != "linux/amd64" ]]; then
6+
echo "oracle extension not available for ${TARGETPLATFORM} architecture, skipping"
7+
exit 0
8+
fi
9+
510
echo "Downloading oracle files"
611
curl https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip \
712
-o /tmp/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip

root/tmp/setup/php-extensions.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/inclu
6060
docker-php-ext-install -j$(nproc) gd
6161

6262
# LDAP.
63-
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/
63+
docker-php-ext-configure ldap
6464
docker-php-ext-install -j$(nproc) ldap
6565

6666
# APCu, igbinary, Memcached, MongoDB, Redis, Solr, uuid, XMLRPC (beta)
@@ -72,7 +72,11 @@ echo 'apc.enable_cli = On' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini
7272
# Install Microsoft dependencies for sqlsrv.
7373
# (kept apart for clarity, still need to be run here
7474
# before some build packages are deleted)
75-
/tmp/setup/sqlsrv-extension.sh
75+
if [[ ${TARGETPLATFORM} == "linux/amd64" ]]; then
76+
/tmp/setup/sqlsrv-extension.sh
77+
else
78+
echo "sqlsrv extension not available for ${TARGETPLATFORM} architecture, skipping"
79+
fi
7680

7781
# Keep our image size down..
7882
pecl clear-cache

0 commit comments

Comments
 (0)