blob: 78c8944c85cb9ea49ebf7c93a097fdc0f751d9f5 [file] [log] [blame]
Matthias Andreas Benkarde85ed082026-11-14 21:37:36 +01001# Phorge, built from the official PHP image.
2#
3# Based on the Dockerfile of the former ghcr.io/datenknoten/phorge image
4# (github.com/phorge-docker/phorge, no longer available).
5#
6# To upgrade, set PHORGE_REF and ARCANIST_REF to the current heads of the
7# stable branches:
8#
9# git ls-remote https://we.phorge.it/source/phorge.git refs/heads/stable
10# git ls-remote https://we.phorge.it/source/arcanist.git refs/heads/stable
11
12FROM php:8.4-apache-trixie
13
14# Phorge 2026.27 (stable)
15ARG PHORGE_REF=7d2dd8899c3b31bfd7a61d8e0de94b9b9a675615
16ARG ARCANIST_REF=34b8b54e0a01a2622acea78b0b9ca82b45141f98
17
18RUN apt-get update \
19 && apt-get install -y --no-install-recommends \
20 git \
21 mercurial \
22 subversion \
23 ca-certificates \
24 python3-pygments \
25 imagemagick \
26 openssh-client \
27 openssh-server \
28 procps \
29 sudo \
30 && rm -rf /var/lib/apt/lists/*
31
32RUN set -ex; \
33 a2enmod rewrite; \
34 savedAptMark="$(apt-mark showmanual)"; \
35 apt-get update; \
36 apt-get install -y --no-install-recommends \
37 libonig-dev \
38 libcurl4-openssl-dev \
39 libjpeg62-turbo-dev \
40 libpng-dev \
41 libfreetype-dev \
42 libzip-dev \
43 ; \
44 docker-php-ext-configure gd --with-jpeg --with-freetype; \
45 docker-php-ext-install -j "$(nproc)" \
46 gd \
47 opcache \
48 mbstring \
49 iconv \
50 mysqli \
51 curl \
52 pcntl \
53 zip \
54 ; \
55 pecl install apcu; \
56 docker-php-ext-enable apcu; \
57 apt-mark auto '.*' > /dev/null; \
58 apt-mark manual $savedAptMark; \
59 ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
60 | awk '/=>/ { print $3 }' \
61 | sort -u \
62 | xargs -r realpath \
63 | xargs -r dpkg-query -S \
64 | cut -d: -f1 \
65 | sort -u \
66 | xargs -rt apt-mark manual; \
67 apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
68 rm -rf /var/lib/apt/lists/* /tmp/pear
69
70RUN { \
71 echo 'opcache.memory_consumption=128'; \
72 echo 'opcache.interned_strings_buffer=8'; \
73 echo 'opcache.max_accelerated_files=4000'; \
74 echo 'opcache.revalidate_freq=60'; \
75 echo 'opcache.validate_timestamps=0'; \
76 } > /usr/local/etc/php/conf.d/opcache-recommended.ini \
77 && echo 'date.timezone="UTC"' > /usr/local/etc/php/conf.d/timezone.ini \
78 && { \
79 echo 'post_max_size=32M'; \
80 echo 'upload_max_filesize=32M'; \
81 } > /usr/local/etc/php/conf.d/uploads.ini
82
83RUN mkdir /var/repo && chown www-data:www-data /var/repo
84
85RUN git clone https://we.phorge.it/source/arcanist.git /opt/arcanist \
86 && git -C /opt/arcanist checkout --detach "$ARCANIST_REF" \
87 && git clone https://we.phorge.it/source/phorge.git /opt/phorge \
88 && git -C /opt/phorge checkout --detach "$PHORGE_REF"
89
90WORKDIR /opt/phorge
91
92RUN rmdir /var/www/html \
93 && ln -sf /opt/phorge/webroot /var/www/html \
94 && { \
95 echo '<VirtualHost *:80>'; \
96 echo ' RewriteEngine on'; \
97 echo ' RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]'; \
98 echo '</VirtualHost>'; \
99 } > /etc/apache2/sites-available/000-default.conf
100
101COPY sudoers /etc/sudoers
102ENV PATH="$PATH:/opt/phorge/bin:/var/www/phorge/bin"
103
104RUN ln -s phorge /var/lib/phabricator
105
106RUN ln -s /opt/phorge /var/www/phorge
107RUN ln -s phorge /var/www/phabricator