Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Debian base image #6

Merged
merged 4 commits into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 100 additions & 121 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,159 +1,138 @@
ARG PHP_TAG_VERSION
FROM php:${PHP_TAG_VERSION}
FROM debian:11-slim

ARG DEBIAN_FRONTEND=noninteractive
ARG PHP_TAG_VERSION

RUN set -eux; \
apt-get update; \
apt-get install -yq \
git \
libbz2-dev \
libcurl4-gnutls-dev \
libxml2-dev \
libjpeg-dev \
libpng-dev \
libgmp3-dev \
libicu-dev \
libldap2-dev \
libpq-dev \
libsqlite3-dev \
libpspell-dev \
libedit-dev \
librecode-dev \
libsnmp-dev \
# libmcrypt-dev libpq-dev libvpx-dev libxpm-dev zlib1g-dev libfreetype6-dev libexpat1-dev unixodbc-dev libaspell-dev libpcre3-dev libtidy-dev
libzip-dev zip unzip \
gnupg \
nodejs \
apt-get install -y apt-transport-https lsb-release ca-certificates curl wget; \
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; \
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list; \
apt-get update; \
apt-get install -yq git libzip-dev zip unzip gnupg \
# nodejs \
; \
if [ ${PHP_TAG_VERSION} = "5.6" ] || [ ${PHP_TAG_VERSION} = "7.0" ] || [ ${PHP_TAG_VERSION} = "7.1" ] || [ ${PHP_TAG_VERSION} = "7.2" ]; then \
apt-get install -yq libenchant-dev; \
else \
apt-get install -yq libenchant-2-dev; \
fi; \
apt upgrade -yq --purge

RUN set -eux; \
# Install and run Composer
curl -sS https://getcomposer.org/installer | php; \
mv composer.phar /usr/local/bin/composer; \
chmod +x /usr/local/bin/composer; \
# Install deployer
curl -LO https://deployer.org/deployer.phar; \
mv deployer.phar /usr/local/bin/dep; \
chmod +x /usr/local/bin/dep;
# apt-get install -y php${PHP_TAG_VERSION}
apt-get update \
;

RUN set -eux; \
docker-php-ext-install bcmath bz2 calendar ctype curl dba dom exif; \
if [ ${PHP_TAG_VERSION} = "5.6" ] || [ ${PHP_TAG_VERSION} = "7.0" ] || [ ${PHP_TAG_VERSION} = "7.1" ] || [ ${PHP_TAG_VERSION} = "7.2" ]; then \
docker-php-ext-install enchant; \
else \
# docker-php-ext-install enchant-2; \
echo "TODO: need implement"; \
apt-get install -y \
php${PHP_TAG_VERSION}-bcmath \
php${PHP_TAG_VERSION}-bz2 \
php${PHP_TAG_VERSION}-cli \
php${PHP_TAG_VERSION}-fpm \
php${PHP_TAG_VERSION}-curl \
# decimal 不支援 5.6
# php${PHP_TAG_VERSION}-decimal \
php${PHP_TAG_VERSION}-enchant \
# ffi 不支援 7.3
# php${PHP_TAG_VERSION}-ffi \
php${PHP_TAG_VERSION}-gd \
php${PHP_TAG_VERSION}-gearman \
php${PHP_TAG_VERSION}-gettext \
php${PHP_TAG_VERSION}-gmp \
php${PHP_TAG_VERSION}-gnupg \
php${PHP_TAG_VERSION}-iconv \
php${PHP_TAG_VERSION}-imap \
# php${PHP_TAG_VERSION}-interbase \
php${PHP_TAG_VERSION}-intl \
php${PHP_TAG_VERSION}-ldap \
php${PHP_TAG_VERSION}-mbstring \
php${PHP_TAG_VERSION}-mcrypt \
php${PHP_TAG_VERSION}-mongodb \
php${PHP_TAG_VERSION}-mysql \
php${PHP_TAG_VERSION}-odbc \
php${PHP_TAG_VERSION}-opcache \
php${PHP_TAG_VERSION}-pgsql \
php${PHP_TAG_VERSION}-posix \
php${PHP_TAG_VERSION}-pspell \
php${PHP_TAG_VERSION}-redis \
php${PHP_TAG_VERSION}-sqlite3 \
# php${PHP_TAG_VERSION}-sybase \
php${PHP_TAG_VERSION}-xmlwriter \
php${PHP_TAG_VERSION}-zip \
# php${PHP_TAG_VERSION}-hash \
;
RUN set -eux; \
if [ ${PHP_TAG_VERSION} != "5.6" ]; then \
apt-get install -y php${PHP_TAG_VERSION}-decimal; \
fi; \
if [ ${PHP_TAG_VERSION} != "7.3" ] && \
[ ${PHP_TAG_VERSION} != "7.2" ] && \
[ ${PHP_TAG_VERSION} != "7.1" ] && \
[ ${PHP_TAG_VERSION} != "7.0" ] && \
[ ${PHP_TAG_VERSION} != "5.6" ]; then \
apt-get install -y php${PHP_TAG_VERSION}-ffi; \
fi

RUN set -eux; \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
if [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ]; then \
docker-php-ext-install ffi \
;fi \
;fi
RUN set -eux; docker-php-ext-install fileinfo
# RUN set -eux; docker-php-ext-install filter
# RUN set -eux; docker-php-ext-install ftp
RUN set -eux; docker-php-ext-install gd
RUN set -eux; docker-php-ext-install gettext
RUN set -eux; \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h \
;fi ;\
docker-php-ext-install gmp
RUN set -eux; \
if [ $(php -r "echo PHP_MAJOR_VERSION;") != "7" ]; then \
if [ $(php -r "echo PHP_MINOR_VERSION;") != "4" ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") != "8" ]; then \
docker-php-ext-install hash \
;fi \
;fi \
;fi
RUN set -eux; docker-php-ext-install iconv
RUN set -eux; \
apt-get install -y libc-client-dev libkrb5-dev ;\
docker-php-ext-configure imap --with-kerberos --with-imap-ssl ;\
docker-php-ext-install imap
RUN set -eux; docker-php-ext-install intl
RUN set -eux; \
if [ $(php -r "echo PHP_MAJOR_VERSION;") != "8" ]; then \
docker-php-ext-install json \
;fi
RUN set -eux; \
apt-get install -y libldap2-dev; \
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ ;\
docker-php-ext-install ldap
RUN set -eux; \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
if [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ]; then \
apt-get install -yqq libonig-dev \
;fi \
;fi
# RUN set -eux; \
# if [ $(php -r "echo PHP_MAJOR_VERSION;") != "7" ]; then \
# if [ $(php -r "echo PHP_MINOR_VERSION;") != "4" ]; then \
# if [ $(php -r "echo PHP_MAJOR_VERSION;") != "8" ]; then \
# apt-get install -y php${PHP_TAG_VERSION}-hash; \
# fi; \
# fi; \
# fi
RUN set -eux; \
if [ $(php -r "echo PHP_MAJOR_VERSION;") != "8" ]; then \
docker-php-ext-install mbstring \
;fi
RUN set -eux; docker-php-ext-install mysqli
apt-get install -y php${PHP_TAG_VERSION}-json; \
fi
# RUN set -eux; \
# if [ $(php -r "echo PHP_MAJOR_VERSION;") != "8" ]; then \
# apt-get install -y php${PHP_TAG_VERSION}-mbstring; \
# fi
# RUN set -eux; docker-php-ext-install oci8
# RUN set -eux; \
# apt-get install -yqq unixodbc unixodbc-dev; \
# docker-php-ext-configure odbc --with-unixODBC=shared,/usr; \
# docker-php-ext-install odbc
RUN set -eux; docker-php-ext-install opcache
RUN set -eux; docker-php-ext-install pcntl
RUN set -eux; docker-php-ext-install pdo
RUN set -eux; \
apt-get install -yqq freetds-bin freetds-dev ;\
ln -s /usr/lib/x86_64-linux-gnu/libsybdb.a /usr/lib/ ;\
docker-php-ext-install pdo_dblib
# RUN set -eux; docker-php-ext-install pdo_firebird
RUN set -eux; docker-php-ext-install pdo_mysql
# RUN set -eux; docker-php-ext-install pdo_oci
# RUN apt-get install -y php${PHP_TAG_VERSION}-pcntl
# RUN set -eux; \
# apt-get install -yqq unixodbc unixodbc-dev; \
# docker-php-ext-configure pdo_odbc --with-unixODBC=shared,/usr; \
# docker-php-ext-install pdo_odbc
RUN set -eux; docker-php-ext-install pdo_pgsql
RUN set -eux; docker-php-ext-install pdo_sqlite
RUN set -eux; docker-php-ext-install pgsql
# apt-get install -yqq freetds-bin freetds-dev ;\
# ln -s /usr/lib/x86_64-linux-gnu/libsybdb.a /usr/lib/ ;\
# apt-get install -y php${PHP_TAG_VERSION}-pdo_dblib
# RUN set -eux; docker-php-ext-install pdo_oci
# RUN set -eux; docker-php-ext-install phar
RUN set -eux; docker-php-ext-install posix
RUN set -eux; docker-php-ext-install pspell
RUN set -eux; \
if [ ${PHP_TAG_VERSION} = "5.6" ] || [ ${PHP_TAG_VERSION} = "7.0" ] || [ ${PHP_TAG_VERSION} = "7.1" ] || [ ${PHP_TAG_VERSION} = "7.2" ]; then \
docker-php-ext-install readline; \
RUN if [ ${PHP_TAG_VERSION} = "5.6" ] || [ ${PHP_TAG_VERSION} = "7.0" ] || [ ${PHP_TAG_VERSION} = "7.1" ] || [ ${PHP_TAG_VERSION} = "7.2" ]; then \
apt-get install -y php${PHP_TAG_VERSION}-readline; \
fi; \
php -m | grep -oiE '^readline$'
# RUN set -eux; docker-php-ext-install reflection
RUN set -eux; \
docker-php-ext-install session shmop simplexml snmp soap sockets
# RUN set -eux; \
# docker-php-ext-install session shmop simplexml snmp soap sockets
# RUN set -eux; docker-php-ext-install sodium
# RUN set -eux; docker-php-ext-install spl
# RUN set -eux; docker-php-ext-install standard
RUN set -eux; \
docker-php-ext-install sysvmsg sysvsem sysvshm
# RUN set -eux; \
# docker-php-ext-install sysvmsg sysvsem sysvshm
# RUN set -eux; docker-php-ext-install tidy
RUN set -eux; \
if [ $(PHP_TAG_VERSION) != "8.1" ]; then \
docker-php-ext-install tokenizer; \
apt-get install -y php${PHP_TAG_VERSION}-tokenizer; \
php -m | grep -oiE '^tokenizer$'; \
fi
RUN set -eux; docker-php-ext-install xml
RUN apt-get install -y php${PHP_TAG_VERSION}-xml; \
php -m | grep -oiE '^xml$'
# RUN set -eux; docker-php-ext-install xmlreader
RUN set -eux; \
if [ $(php -r "echo PHP_MAJOR_VERSION;") != "8" ]; then \
docker-php-ext-install xmlrpc \
;fi
RUN set -eux; docker-php-ext-install xmlwriter
apt-get install -y php${PHP_TAG_VERSION}-xmlrpc; \
php -m | grep -oiE '^xmlrpc$'; \
fi
# RUN set -eux; docker-php-ext-install xsl
# RUN set -eux; docker-php-ext-install zend_test
RUN set -eux; docker-php-ext-install zip

RUN php${PHP_TAG_VERSION} -m

RUN set -eux; \
php -m
# Install and run Composer
curl -sS https://getcomposer.org/installer | php${PHP_TAG_VERSION}; \
mv composer.phar /usr/local/bin/composer; \
chmod +x /usr/local/bin/composer; \
# Install deployer
curl -LO https://deployer.org/deployer.phar; \
mv deployer.phar /usr/local/bin/dep; \
chmod +x /usr/local/bin/dep;