Skip to content

Instantly share code, notes, and snippets.

@rfay
Last active September 17, 2023 00:52
Show Gist options
  • Save rfay/9e9c9fc994bfcf8d738583b4c8d21e66 to your computer and use it in GitHub Desktop.
Save rfay/9e9c9fc994bfcf8d738583b4c8d21e66 to your computer and use it in GitHub Desktop.
Experimental dockerfile to build specific patch version of php/fpm using static-php-cli
php_version: "7.4"
hooks:
post-start:
- exec: sudo ln -sf /usr/local/src/static-php-cli/buildroot/bin/php /usr/bin/php
- exec: sudo ln -sf /usr/local/src/static-php-cli/buildroot/bin/php-fpm /usr/sbin/php-fpm
- exec: sudo ln -sf /etc/php/${DDEV_PHP_VERSION}/cli/php.ini /etc/php.ini
- exec: sudo ln -sf /etc/php/${DDEV_PHP_VERSION}/fpm/php-fpm.conf /etc/php-fpm.conf
- exec: sudo killall -HUP supervisord
ENV STATIC_PHP_VERSION=7.4.30
RUN apt update && apt install -y build-essential
RUN mkdir -p /usr/local/src/static-php-cli && chown -R ${uid}:${gid} /usr/local/src
USER ${uid}:${gid}
RUN git clone https://github.com/crazywhalecc/static-php-cli.git /usr/local/src/static-php-cli/.
WORKDIR /usr/local/src/static-php-cli
RUN composer update
RUN chmod +x bin/spc
RUN ./bin/spc doctor --auto-fix
# RUN bin/spc download --clean
# RUN rm -rf source/* downloads/*
RUN bin/spc download --all -U "php-src:https://www.php.net/distributions/php-${STATIC_PHP_VERSION}.tar.gz"
# opcache would normally be here but build fails: https://github.com/crazywhalecc/static-php-cli/issues/192
RUN bin/spc build bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl,phar,pdo,pdo_mysql,xml,gd,openssl,mbstring,apcu,fileinfo,session,filter,ctype,dom,simplexml --build-cli --build-fpm
USER root
#RUN chown -R ${uid}:${gid} .
#RUN ln -sf /usr/local/src/static-php-cli/buildroot/bin/php /usr/bin/php
#RUN ln -sf /usr/local/src/static-php-cli/buildroot/bin/php-fpm /usr/sbin/php-fpm
#RUN ln -sf /etc/php/${DDEV_PHP_VERSION}/cli/php.ini /etc/php.ini
#RUN ln -sf /etc/php/${DDEV_PHP_VERSION}/fpm/php-fpm.conf /etc/php-fpm.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment