2019-12-17 13:21:47 +03:00
|
|
|
FROM php:7.4.0-alpine3.10
|
2019-08-16 19:38:26 +03:00
|
|
|
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"
|
|
|
|
|
2019-12-18 16:54:48 +03:00
|
|
|
ARG SHLINK_VERSION=1.20.2
|
2019-08-16 20:42:39 +03:00
|
|
|
ENV SHLINK_VERSION ${SHLINK_VERSION}
|
2019-11-15 19:55:06 +03:00
|
|
|
ENV SWOOLE_VERSION 4.4.12
|
|
|
|
ENV COMPOSER_VERSION 1.9.1
|
2019-08-16 19:38:26 +03:00
|
|
|
|
|
|
|
WORKDIR /etc/shlink
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
# Install mysl and calendar
|
|
|
|
docker-php-ext-install -j"$(nproc)" pdo_mysql calendar && \
|
|
|
|
# Install sqlite
|
|
|
|
apk add --no-cache sqlite-libs sqlite-dev && \
|
|
|
|
docker-php-ext-install -j"$(nproc)" pdo_sqlite && \
|
|
|
|
# Install postgres
|
|
|
|
apk add --no-cache postgresql-dev && \
|
|
|
|
docker-php-ext-install -j"$(nproc)" pdo_pgsql && \
|
2019-11-16 11:46:42 +03:00
|
|
|
# Install intl
|
2019-08-16 19:38:26 +03:00
|
|
|
apk add --no-cache icu-dev && \
|
2019-11-16 11:46:42 +03:00
|
|
|
docker-php-ext-install -j"$(nproc)" intl && \
|
2019-08-16 19:38:26 +03:00
|
|
|
# Install zip and gd
|
|
|
|
apk add --no-cache libzip-dev zlib-dev libpng-dev && \
|
|
|
|
docker-php-ext-install -j"$(nproc)" zip gd
|
|
|
|
|
|
|
|
# Install swoole
|
|
|
|
# First line fixes an error when installing pecl extensions. Found in https://github.com/docker-library/php/issues/233
|
2019-08-16 20:30:40 +03:00
|
|
|
RUN apk add --no-cache --virtual .phpize-deps ${PHPIZE_DEPS} && \
|
2019-08-16 19:38:26 +03:00
|
|
|
pecl install swoole-${SWOOLE_VERSION} && \
|
|
|
|
docker-php-ext-enable swoole && \
|
|
|
|
apk del .phpize-deps
|
|
|
|
|
|
|
|
# Install shlink
|
|
|
|
COPY . .
|
|
|
|
RUN rm -rf ./docker && \
|
|
|
|
wget https://getcomposer.org/download/${COMPOSER_VERSION}/composer.phar && \
|
2019-08-17 18:19:33 +03:00
|
|
|
php composer.phar install --no-dev --optimize-autoloader --prefer-dist --no-progress --no-interaction && \
|
2019-08-16 19:38:26 +03:00
|
|
|
php composer.phar clear-cache && \
|
2019-08-16 19:55:35 +03:00
|
|
|
rm composer.*
|
2019-08-16 19:38:26 +03:00
|
|
|
|
|
|
|
# Add shlink to the path to ease running it after container is created
|
|
|
|
RUN ln -s /etc/shlink/bin/cli /usr/local/bin/shlink
|
2019-08-16 20:42:39 +03:00
|
|
|
RUN sed -i "s/%SHLINK_VERSION%/${SHLINK_VERSION}/g" config/autoload/app_options.global.php
|
2019-08-16 19:38:26 +03:00
|
|
|
|
|
|
|
# Expose swoole port
|
|
|
|
EXPOSE 8080
|
|
|
|
|
|
|
|
# Expose params config dir, since the user is expected to provide custom config from there
|
|
|
|
VOLUME /etc/shlink/config/params
|
|
|
|
|
|
|
|
# Copy config specific for the image
|
|
|
|
COPY docker/docker-entrypoint.sh docker-entrypoint.sh
|
|
|
|
COPY docker/config/shlink_in_docker.local.php config/autoload/shlink_in_docker.local.php
|
2019-12-18 16:54:48 +03:00
|
|
|
COPY docker/config/php.ini ${PHP_INI_DIR}/conf.d/
|
2019-08-16 19:38:26 +03:00
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/sh", "./docker-entrypoint.sh"]
|