From 9eff087cdf9a7e4982b1c5c6bab24e9a8387a5c5 Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Sun, 1 Mar 2026 19:07:42 -0500 Subject: refactor: Dockerfile --- Dockerfile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c975146 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,47 @@ +FROM php:8.3-apache + +# install fonts, fontconfig (for fc-list), and tini (proper PID 1 / signal relay) +RUN apt-get update && apt-get install -y --no-install-recommends \ + tini \ + fontconfig \ + fonts-dejavu \ + fonts-noto-color-emoji \ + fonts-noto-core \ + fonts-liberation \ + fonts-roboto \ + fonts-hack \ + && rm -rf /var/lib/apt/lists/* \ + && fc-cache -fv + +# configure apache: set document root to /var/www/html/src +ENV APACHE_DOCUMENT_ROOT=/var/www/html/src +RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' \ + /etc/apache2/sites-available/*.conf \ + /etc/apache2/apache2.conf \ + /etc/apache2/conf-available/*.conf + +# switch apache from port 80 to port 3000 +RUN sed -i 's/Listen 80/Listen 3000/' /etc/apache2/ports.conf \ + && sed -i 's///' \ + /etc/apache2/sites-available/*.conf + +# enable mod_rewrite +RUN a2enmod rewrite + +# php upload limits +RUN echo "upload_max_filesize = 50M" > /usr/local/etc/php/conf.d/sent-web.ini \ + && echo "post_max_size = 50M" >> /usr/local/etc/php/conf.d/sent-web.ini + +# copy application +COPY src/ /var/www/html/src/ + +# ensure uploads directory exists with correct permissions +RUN mkdir -p /var/www/html/src/uploads \ + && chown -R www-data:www-data /var/www/html/src/uploads + +EXPOSE 3000 + +# tini as PID 1 ensures SIGTERM is properly forwarded to apache, +# preventing the 'permission denied' error on docker stop +ENTRYPOINT ["/usr/bin/tini", "--"] +CMD ["apache2-foreground"] \ No newline at end of file -- cgit v1.2.3