Skip to content

Commit

Permalink
Towards multi-arch images support
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
stronk7 committed Aug 14, 2021
1 parent 94e6c1f commit 8dd739b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
FROM php:8.0-apache-buster

# So we can use it anywhere for conditional stuff. Keeping BC with old (non-buildkit, builders)
ARG TARGETPLATFORM
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
RUN echo "Building for ${TARGETPLATFORM}"

ADD root/ /
# Fix the original permissions of /tmp, the PHP default upload tmp dir.
RUN chmod 777 /tmp && chmod +t /tmp
Expand Down
5 changes: 5 additions & 0 deletions root/tmp/setup/oci8-extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -e

if [[ ${TARGETPLATFORM} != "linux/amd64" ]]; then
echo "oracle extension not available for ${TARGETPLATFORM} architecture, skipping"
exit 0
fi

echo "Downloading oracle files"
curl https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip \
-o /tmp/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip
Expand Down
8 changes: 6 additions & 2 deletions root/tmp/setup/php-extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/inclu
docker-php-ext-install -j$(nproc) gd

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

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

# Keep our image size down..
pecl clear-cache
Expand Down

0 comments on commit 8dd739b

Please sign in to comment.