2020-10-16 12:28:57 -05:00
|
|
|
FROM php:7.4.11-alpine3.12 as base
|
2019-08-16 11:38:26 -05:00
|
|
|
|
2020-11-10 09:08:22 -06:00
|
|
|
ARG SHLINK_VERSION=2.4.0
|
2019-08-16 12:42:39 -05:00
|
|
|
ENV SHLINK_VERSION ${SHLINK_VERSION}
|
2020-12-06 04:41:27 -06:00
|
|
|
ENV SWOOLE_VERSION 4.5.9
|
2020-02-14 12:44:11 -06:00
|
|
|
ENV LC_ALL "C"
|
2019-08-16 11:38:26 -05:00
|
|
|
|
|
|
|
WORKDIR /etc/shlink
|
|
|
|
|
2020-11-02 02:02:00 -06:00
|
|
|
# Install required PHP extensions
|
2019-08-16 11:38:26 -05:00
|
|
|
RUN \
|
2020-03-21 02:42:13 -05:00
|
|
|
# Install mysql and calendar
|
2019-08-16 11:38:26 -05:00
|
|
|
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 02:46:42 -06:00
|
|
|
# Install intl
|
2019-08-16 11:38:26 -05:00
|
|
|
apk add --no-cache icu-dev && \
|
2019-11-16 02:46:42 -06:00
|
|
|
docker-php-ext-install -j"$(nproc)" intl && \
|
2019-08-16 11:38:26 -05:00
|
|
|
# Install zip and gd
|
|
|
|
apk add --no-cache libzip-dev zlib-dev libpng-dev && \
|
2020-11-02 02:02:00 -06:00
|
|
|
docker-php-ext-install -j"$(nproc)" zip gd && \
|
|
|
|
# Install gmp
|
|
|
|
apk add --no-cache gmp-dev && \
|
|
|
|
docker-php-ext-install -j"$(nproc)" gmp
|
2019-08-16 11:38:26 -05:00
|
|
|
|
2020-05-05 14:58:23 -05:00
|
|
|
# Install sqlsrv driver
|
|
|
|
RUN if [ $(uname -m) == "x86_64" ]; then \
|
|
|
|
wget https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.1.1-1_amd64.apk && \
|
|
|
|
apk add --allow-untrusted msodbcsql17_17.5.1.1-1_amd64.apk && \
|
2020-11-02 02:24:14 -06:00
|
|
|
apk add --no-cache --virtual .phpize-deps ${PHPIZE_DEPS} unixodbc-dev && \
|
2020-05-05 14:58:23 -05:00
|
|
|
pecl install pdo_sqlsrv && \
|
|
|
|
docker-php-ext-enable pdo_sqlsrv && \
|
|
|
|
apk del .phpize-deps && \
|
2020-05-15 11:40:20 -05:00
|
|
|
rm msodbcsql17_17.5.1.1-1_amd64.apk ; \
|
2020-05-05 14:58:23 -05:00
|
|
|
fi
|
2019-08-16 11:38:26 -05:00
|
|
|
|
2020-05-05 14:58:23 -05:00
|
|
|
# Install swoole
|
2020-11-02 02:24:14 -06:00
|
|
|
RUN apk add --no-cache --virtual .phpize-deps ${PHPIZE_DEPS} && \
|
2020-05-05 14:58:23 -05:00
|
|
|
pecl install swoole-${SWOOLE_VERSION} && \
|
|
|
|
docker-php-ext-enable swoole && \
|
|
|
|
apk del .phpize-deps
|
2020-03-21 02:56:48 -05:00
|
|
|
|
2020-05-16 03:39:47 -05:00
|
|
|
|
2019-08-16 11:38:26 -05:00
|
|
|
# Install shlink
|
2020-03-21 02:56:48 -05:00
|
|
|
FROM base as builder
|
2019-08-16 11:38:26 -05:00
|
|
|
COPY . .
|
2020-10-25 11:59:37 -05:00
|
|
|
COPY --from=composer:2 /usr/bin/composer ./composer.phar
|
2020-03-22 04:01:34 -05:00
|
|
|
RUN apk add --no-cache git && \
|
|
|
|
php composer.phar install --no-dev --optimize-autoloader --prefer-dist --no-progress --no-interaction && \
|
2020-03-21 10:11:56 -05:00
|
|
|
php composer.phar clear-cache && \
|
2020-03-22 04:01:34 -05:00
|
|
|
rm -r docker composer.* && \
|
2020-03-21 02:56:48 -05:00
|
|
|
sed -i "s/%SHLINK_VERSION%/${SHLINK_VERSION}/g" config/autoload/app_options.global.php
|
|
|
|
|
|
|
|
|
|
|
|
# Prepare final image
|
|
|
|
FROM base
|
|
|
|
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"
|
2019-08-16 11:38:26 -05:00
|
|
|
|
2020-03-21 02:56:48 -05:00
|
|
|
COPY --from=builder /etc/shlink .
|
2019-08-16 11:38:26 -05:00
|
|
|
RUN ln -s /etc/shlink/bin/cli /usr/local/bin/shlink
|
|
|
|
|
2020-10-03 04:49:25 -05:00
|
|
|
# Expose default swoole port
|
2019-08-16 11:38:26 -05:00
|
|
|
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 07:54:48 -06:00
|
|
|
COPY docker/config/php.ini ${PHP_INI_DIR}/conf.d/
|
2019-08-16 11:38:26 -05:00
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/sh", "./docker-entrypoint.sh"]
|