1# Force this to build with arm64 even when the host architecture is different.
2# This requires that cross-compilation support be enabled with the steps in https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
3FROM --platform=arm64 ubuntu:20.04
4RUN apt-get update -y
5# DEBIAN_FRONTEND=noninteractive is needed to stop the tzdata installation from hanging.
6ENV DEBIAN_FRONTEND=noninteractive
7RUN apt-get install -y tzdata
8RUN apt-get install -y pkg-config build-essential autoconf bison re2c \
9                       libxml2-dev libsqlite3-dev
10
11ADD . /php-src/
12WORKDIR /php-src
13RUN ./buildconf
14# Compile a minimal debug build. --enable-debug adds runtime assertions and is slower than regular builds.
15RUN ./configure --enable-debug --disable-all --enable-opcache && make clean && make -j$(nproc)
16