2019-11-16 00:05:34 +03:00
|
|
|
FROM php:7.3.11-alpine3.10
|
2018-11-24 10:43:48 +03:00
|
|
|
MAINTAINER Alejandro Celaya <alejandro@alejandrocelaya.com>
|
|
|
|
|
2019-11-16 00:05:34 +03:00
|
|
|
ENV APCU_VERSION 5.1.18
|
|
|
|
ENV APCU_BC_VERSION 1.0.5
|
2019-02-24 15:22:44 +03:00
|
|
|
ENV INOTIFY_VERSION 2.0.0
|
2019-11-16 00:05:34 +03:00
|
|
|
ENV SWOOLE_VERSION 4.4.12
|
2019-02-02 12:53:34 +03:00
|
|
|
|
2018-11-24 10:43:48 +03:00
|
|
|
RUN apk update
|
|
|
|
|
|
|
|
# Install common php extensions
|
|
|
|
RUN docker-php-ext-install pdo_mysql
|
|
|
|
RUN docker-php-ext-install iconv
|
|
|
|
RUN docker-php-ext-install mbstring
|
|
|
|
RUN docker-php-ext-install calendar
|
|
|
|
|
2019-11-16 00:05:34 +03:00
|
|
|
RUN apk add --no-cache sqlite-libs
|
|
|
|
RUN apk add --no-cache sqlite-dev
|
2018-11-24 10:43:48 +03:00
|
|
|
RUN docker-php-ext-install pdo_sqlite
|
|
|
|
|
2019-11-16 00:05:34 +03:00
|
|
|
RUN apk add --no-cache icu-dev
|
2019-11-16 11:46:42 +03:00
|
|
|
RUN docker-php-ext-install intl
|
2018-11-24 10:43:48 +03:00
|
|
|
|
2019-11-16 00:05:34 +03:00
|
|
|
RUN apk add --no-cache libzip-dev zlib-dev
|
2018-11-24 10:43:48 +03:00
|
|
|
RUN docker-php-ext-install zip
|
|
|
|
|
2019-11-16 00:05:34 +03:00
|
|
|
RUN apk add --no-cache libpng-dev
|
2018-11-24 10:43:48 +03:00
|
|
|
RUN docker-php-ext-install gd
|
|
|
|
|
2019-03-05 15:39:45 +03:00
|
|
|
RUN apk add --no-cache postgresql-dev
|
|
|
|
RUN docker-php-ext-install pdo_pgsql
|
|
|
|
|
2018-11-24 10:43:48 +03:00
|
|
|
# Install APCu extension
|
2019-02-02 12:53:34 +03:00
|
|
|
ADD https://pecl.php.net/get/apcu-$APCU_VERSION.tgz /tmp/apcu.tar.gz
|
2018-11-24 10:43:48 +03:00
|
|
|
RUN mkdir -p /usr/src/php/ext/apcu\
|
|
|
|
&& tar xf /tmp/apcu.tar.gz -C /usr/src/php/ext/apcu --strip-components=1
|
|
|
|
# configure and install
|
|
|
|
RUN docker-php-ext-configure apcu\
|
|
|
|
&& docker-php-ext-install apcu
|
|
|
|
# cleanup
|
|
|
|
RUN rm /tmp/apcu.tar.gz
|
|
|
|
|
|
|
|
# Install APCu-BC extension
|
2019-02-02 12:53:34 +03:00
|
|
|
ADD https://pecl.php.net/get/apcu_bc-$APCU_BC_VERSION.tgz /tmp/apcu_bc.tar.gz
|
2018-11-24 10:43:48 +03:00
|
|
|
RUN mkdir -p /usr/src/php/ext/apcu-bc\
|
|
|
|
&& tar xf /tmp/apcu_bc.tar.gz -C /usr/src/php/ext/apcu-bc --strip-components=1
|
|
|
|
# configure and install
|
|
|
|
RUN docker-php-ext-configure apcu-bc\
|
|
|
|
&& docker-php-ext-install apcu-bc
|
|
|
|
# cleanup
|
|
|
|
RUN rm /tmp/apcu_bc.tar.gz
|
|
|
|
|
|
|
|
# Load APCU.ini before APC.ini
|
|
|
|
RUN rm /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini
|
|
|
|
RUN echo extension=apcu.so > /usr/local/etc/php/conf.d/20-php-ext-apcu.ini
|
|
|
|
|
2019-02-24 15:22:44 +03:00
|
|
|
# Install inotify extension
|
|
|
|
ADD https://pecl.php.net/get/inotify-$INOTIFY_VERSION.tgz /tmp/inotify.tar.gz
|
|
|
|
RUN mkdir -p /usr/src/php/ext/inotify\
|
|
|
|
&& tar xf /tmp/inotify.tar.gz -C /usr/src/php/ext/inotify --strip-components=1
|
|
|
|
# configure and install
|
|
|
|
RUN docker-php-ext-configure inotify\
|
|
|
|
&& docker-php-ext-install inotify
|
|
|
|
# cleanup
|
|
|
|
RUN rm /tmp/inotify.tar.gz
|
|
|
|
|
2018-11-24 10:43:48 +03:00
|
|
|
# Install swoole
|
|
|
|
# First line fixes an error when installing pecl extensions. Found in https://github.com/docker-library/php/issues/233
|
|
|
|
RUN apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS && \
|
2019-11-01 11:52:56 +03:00
|
|
|
pecl install swoole-${SWOOLE_VERSION} && \
|
2018-11-24 10:43:48 +03:00
|
|
|
docker-php-ext-enable swoole && \
|
|
|
|
apk del .phpize-deps
|
|
|
|
|
|
|
|
# Install composer
|
|
|
|
RUN php -r "readfile('https://getcomposer.org/installer');" | php
|
|
|
|
RUN chmod +x composer.phar
|
|
|
|
RUN mv composer.phar /usr/local/bin/composer
|
|
|
|
|
|
|
|
# Make home directory writable by anyone
|
|
|
|
RUN chmod 777 /home
|
|
|
|
|
|
|
|
VOLUME /home/shlink
|
|
|
|
WORKDIR /home/shlink
|
|
|
|
|
|
|
|
# Expose swoole port
|
|
|
|
EXPOSE 8080
|
|
|
|
|
2019-07-23 17:36:56 +03:00
|
|
|
CMD \
|
|
|
|
# Install dependencies if the vendor dir does not exist
|
|
|
|
if [[ ! -d "./vendor" ]]; then /usr/local/bin/composer install ; fi && \
|
2018-11-25 14:44:49 +03:00
|
|
|
# When restarting the container, swoole might think it is already in execution
|
|
|
|
# This forces the app to be started every second until the exit code is 0
|
|
|
|
until php ./vendor/bin/zend-expressive-swoole start; do sleep 1 ; done
|