forked from phabricator-docker/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
126 lines (112 loc) · 3.4 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
##### Start Phabricator
FROM php:7.4-apache-buster
##### End Phabricator
LABEL org.opencontainers.image.source https://github.com/phabricator-docker/phabricator
# Required Components
# @see https://secure.phabricator.com/book/phabricator/article/installation_guide/#installing-required-comp
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
mercurial \
subversion \
ca-certificates \
# @see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=944908
python3-pkg-resources \
python3-pygments \
imagemagick \
# @see https://secure.phabricator.com/w/guides/dependencies/
# provides ssh-keygen and ssh, these are needed to sync ssh repositories
openssh-client \
procps \
&& rm -rf /var/lib/apt/lists/*
# install the PHP extensions we need
RUN set -ex; \
\
if command -v a2enmod; then \
# Phabricator needs mod_rewrite for rewritting to index.php
a2enmod rewrite; \
fi; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libonig-dev \
libcurl4-gnutls-dev \
libjpeg62-turbo-dev \
libpng-dev \
libfreetype6-dev \
libzip-dev \
; \
\
docker-php-ext-configure gd \
--with-jpeg \
--with-freetype \
; \
\
docker-php-ext-install -j "$(nproc)" \
gd \
opcache \
mbstring \
iconv \
mysqli \
curl \
pcntl \
zip \
; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
RUN pecl channel-update pecl.php.net \
&& pecl install apcu \
&& docker-php-ext-enable apcu
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
# From Phabricator
echo 'opcache.validate_timestamps=0'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# Set the default timezone.
RUN { \
echo 'date.timezone="UTC"'; \
} > /usr/local/etc/php/conf.d/timezone.ini
# File Uploads
RUN { \
echo 'post_max_size=32M'; \
echo 'upload_max_filesize=32M'; \
} > /usr/local/etc/php/conf.d/uploads.ini
# Repository Folder.
RUN mkdir /var/repo \
&& chown www-data:www-data /var/repo
##### Start Phabricator
RUN { \
echo '<VirtualHost *:80>'; \
echo ' RewriteEngine on'; \
echo ' RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]'; \
echo '</VirtualHost>'; \
} > /etc/apache2/sites-available/000-default.conf
##### End Phabricator
COPY ./ /opt
WORKDIR /opt/phabricator
##### Start Phabricator
RUN rmdir /var/www/html; \
ln -sf /opt/phabricator/webroot /var/www/html;
##### End Phabricator
RUN git submodule update --init --recursive
ENV PATH "$PATH:/opt/phabricator/bin"