Skip to content

Instantly share code, notes, and snippets.

@Delfins
Created January 18, 2019 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Delfins/23aadc9e418c48e88c4a7491641dc0c9 to your computer and use it in GitHub Desktop.
Save Delfins/23aadc9e418c48e88c4a7491641dc0c9 to your computer and use it in GitHub Desktop.
# Compile PHP with static linked dependencies
# to create a single running binary
FROM amazonlinux
ARG PHP_VERSION
RUN yum install \
autoconf \
automake \
libtool \
bison \
re2c \
libxml2-devel \
# openssl-devel \
libpng-devel \
libjpeg-devel \
curl-devel -y \
mysql
# Install an older version of OpenSSL until Amazon updates the lambda image.
RUN curl -sL http://www.openssl.org/source/openssl-1.0.1k.tar.gz | tar -zxv
WORKDIR /openssl-1.0.1k
RUN ./config
RUN make
RUN make install
WORKDIR /
RUN curl -sL https://github.com/php/php-src/archive/$PHP_VERSION.tar.gz | tar -zxv
WORKDIR /php-src-$PHP_VERSION
RUN ./buildconf --force
RUN ./configure \
--enable-static=yes \
--enable-shared=no \
--disable-all \
--enable-json \
--enable-libxml \
--enable-mbstring \
--enable-phar \
--enable-soap \
--enable-xml \
--enable-pdo \
--with-curl \
--with-gd \
--with-zlib \
--with-openssl \
--without-pear \
--with-mysql \
--with-mysqli \
--with-pdo \
--with-pdo-mysql
RUN make -j 5
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN docker-php-ext-install pdo_mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment