-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
84 lines (73 loc) · 2.2 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
80
81
82
83
84
ARG FROM_TAG=8.3-apache
FROM php:$FROM_TAG
# update image
RUN set -eux; \
apt-get update; \
apt-get upgrade -y --with-new-pkgs; \
apt-get install -y --no-install-recommends \
vim \
wget; \
rm -rf /var/lib/apt/lists/*
# confige php
RUN set -eux; \
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY ./assets/php.ini $PHP_INI_DIR/conf.d/000-default.ini
# install some packages
RUN set -eux; \
apt-get update && apt-get install -y \
# mariadb
mariadb-client \
# for imap
libc-client-dev libkrb5-dev \
# for soap
libxml2-dev \
# cleanup
&& apt-get clean -y && rm -r /var/lib/apt/lists/*
# add php extensions installer
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
# install php extensions
RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions \
@composer \
mysqli \
pdo_mysql \
imap \
soap \
opcache \
gd \
Imagick/imagick@master
# to fix imagick amd64 bug https://github.com/mlocati/docker-php-extension-installer/issues/739
# confige apache
RUN set -eux; \
a2enmod rewrite; \
a2enmod headers; \
a2enmod remoteip; \
rm -r /var/www/html; \
mkdir -p /var/www/html/public /var/www/html_error; \
chown -R www-data:www-data /var/www
COPY ./assets/index.php /var/www/html/public/index.php
COPY ./assets/errordoc.php /var/www/html_error/errordoc.php
COPY ./assets/apache.conf $APACHE_CONFDIR/sites-available/000-default.conf
ARG PYTHON=no-python
# install python
RUN if [ "$PYTHON" = "python" ]; then \
set -eux; \
echo "Build image with python"; \
apt-get update && apt-get install -y \
# python
python3 python3-pip python3-dev python3-venv build-essential \
# cleanup
&& rm -r /var/lib/apt/lists/*; \
fi
# install python modules
RUN if [ "$PYTHON" = "python" ]; then \
set -eux; \
python3 -m venv /opt/venv; \
. /opt/venv/bin/activate; \
python3 -m pip install js2py pytz tzlocal cfscrape; \
fi
# overwrite docker entrypoint
COPY ./assets/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["apache2-foreground"]