diff options
| -rw-r--r-- | Dockerfile | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c975146 --- /dev/null +++ b/Dockerfile | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | FROM php:8.3-apache | ||
| 2 | |||
| 3 | # install fonts, fontconfig (for fc-list), and tini (proper PID 1 / signal relay) | ||
| 4 | RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| 5 | tini \ | ||
| 6 | fontconfig \ | ||
| 7 | fonts-dejavu \ | ||
| 8 | fonts-noto-color-emoji \ | ||
| 9 | fonts-noto-core \ | ||
| 10 | fonts-liberation \ | ||
| 11 | fonts-roboto \ | ||
| 12 | fonts-hack \ | ||
| 13 | && rm -rf /var/lib/apt/lists/* \ | ||
| 14 | && fc-cache -fv | ||
| 15 | |||
| 16 | # configure apache: set document root to /var/www/html/src | ||
| 17 | ENV APACHE_DOCUMENT_ROOT=/var/www/html/src | ||
| 18 | RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' \ | ||
| 19 | /etc/apache2/sites-available/*.conf \ | ||
| 20 | /etc/apache2/apache2.conf \ | ||
| 21 | /etc/apache2/conf-available/*.conf | ||
| 22 | |||
| 23 | # switch apache from port 80 to port 3000 | ||
| 24 | RUN sed -i 's/Listen 80/Listen 3000/' /etc/apache2/ports.conf \ | ||
| 25 | && sed -i 's/<VirtualHost \*:80>/<VirtualHost *:3000>/' \ | ||
| 26 | /etc/apache2/sites-available/*.conf | ||
| 27 | |||
| 28 | # enable mod_rewrite | ||
| 29 | RUN a2enmod rewrite | ||
| 30 | |||
| 31 | # php upload limits | ||
| 32 | RUN echo "upload_max_filesize = 50M" > /usr/local/etc/php/conf.d/sent-web.ini \ | ||
| 33 | && echo "post_max_size = 50M" >> /usr/local/etc/php/conf.d/sent-web.ini | ||
| 34 | |||
| 35 | # copy application | ||
| 36 | COPY src/ /var/www/html/src/ | ||
| 37 | |||
| 38 | # ensure uploads directory exists with correct permissions | ||
| 39 | RUN mkdir -p /var/www/html/src/uploads \ | ||
| 40 | && chown -R www-data:www-data /var/www/html/src/uploads | ||
| 41 | |||
| 42 | EXPOSE 3000 | ||
| 43 | |||
| 44 | # tini as PID 1 ensures SIGTERM is properly forwarded to apache, | ||
| 45 | # preventing the 'permission denied' error on docker stop | ||
| 46 | ENTRYPOINT ["/usr/bin/tini", "--"] | ||
| 47 | CMD ["apache2-foreground"] \ No newline at end of file | ||
