This repository has been archived by the owner on Sep 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
79 lines (61 loc) · 2.83 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
FROM php:7.3.8-cli-alpine3.10
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"
ARG SHLINK_VERSION=1.18.0
ENV SHLINK_VERSION ${SHLINK_VERSION}
ENV APCu_VERSION 5.1.16
ENV APCuBC_VERSION 1.0.4
ENV SWOOLE_VERSION 4.3.3
WORKDIR /etc/shlink
RUN \
# Install common php extensions
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 postgre
apk add --no-cache postgresql-dev && \
docker-php-ext-install -j"$(nproc)" pdo_pgsql && \
# Install other PHP packages that depend on other system packages
apk add --no-cache icu-dev && \
docker-php-ext-install -j"$(nproc)" intl && \
apk add --no-cache libzip-dev zlib-dev libpng-dev && \
docker-php-ext-install -j"$(nproc)" zip gd
# Install APCu
RUN wget "https://pecl.php.net/get/apcu-${APCu_VERSION}.tgz" -O /tmp/apcu.tar.gz && \
mkdir -p /usr/src/php/ext/apcu && \
tar xf /tmp/apcu.tar.gz -C /usr/src/php/ext/apcu --strip-components=1 && \
docker-php-ext-configure apcu && \
docker-php-ext-install -j"$(nproc)" apcu && \
rm /tmp/apcu.tar.gz
# Install APCu-BC extension
RUN wget "https://pecl.php.net/get/apcu_bc-${APCuBC_VERSION}.tgz" -O /tmp/apcu_bc.tar.gz && \
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 && \
docker-php-ext-configure apcu-bc && \
docker-php-ext-install -j"$(nproc)" apcu-bc && \
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 && \
echo extension=apcu.so > /usr/local/etc/php/conf.d/20-php-ext-apcu.ini
# 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 && \
pecl install swoole-${SWOOLE_VERSION} && \
docker-php-ext-enable swoole && \
apk del .phpize-deps
# Install shlink
RUN wget https://github.com/shlinkio/shlink/releases/download/v${SHLINK_VERSION}/shlink_${SHLINK_VERSION}_dist.zip -O /tmp/shlink.zip && \
unzip /tmp/shlink.zip -d /etc/shlink && \
mv shlink_${SHLINK_VERSION}_dist/* . && \
rm -rf shlink_${SHLINK_VERSION}_dist && \
rm -f /tmp/shlink.zip
# Add shlink to the path to ease running it after container is created
RUN ln -s /etc/shlink/bin/cli /usr/local/bin/shlink
# Add shlink in docker config to the project
COPY config/shlink_in_docker.local.php config/autoload/shlink_in_docker.local.php
# 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 docker-entrypoint.sh docker-entrypoint.sh
ENTRYPOINT ["/bin/sh", "./docker-entrypoint.sh"]