diff options
| author | Kyle Javier [kj_sh604] | 2026-03-16 14:24:34 -0400 |
|---|---|---|
| committer | GitHub | 2026-03-16 14:24:34 -0400 |
| commit | 64d8fc9ce9922f38780cc677478cbfb47b21a87e (patch) | |
| tree | 5b244c18193da100a88904536bf1496392339f65 /Dockerfile | |
| parent | 17a970b067fcdf6758668c23184fb2112370bb94 (diff) | |
merge: python rewrite (#1)
* refactor: Dockerfile
* refactor: docker-compose.yml
* refactor: docker-entrypoint.sh
* refactor: src/font.php
* refactor: src/fonts.php
* refactor: src/index.php
* refactor: src/upload.php
* refactor: src/app.py
* refactor: src/index.html
* refactor: src/requirements.txt
* refactor: 24.04 vps compatibility and README re-write
* refactor: python .gitignore update
* refactor: README.md
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 39 |
1 files changed, 14 insertions, 25 deletions
@@ -1,13 +1,15 @@ -FROM php:8.3-apache +FROM python:3.12-slim # enable contrib (fonts-ibm-plex) and non-free (fonts-ubuntu) components RUN sed -i 's/^Components: main$/Components: main contrib non-free/' /etc/apt/sources.list.d/debian.sources -# install fonts, fontconfig (for fc-list), and tini (proper PID 1 / signal relay) +# install fonts, fontconfig (for fc-list), libmagic1 (for python-magic), and tini RUN apt-get update && apt-get install -y --no-install-recommends \ tini \ fontconfig \ - fonts-dejavu fonts-dejavu-core fonts-dejavu-extra fonts-dejavu-mono fonts-liberation fonts-liberation2 fonts-opensymbol fonts-urw-base35 fonts-noto-color-emoji fonts-noto-core fonts-noto-ui-core fonts-noto-extra fonts-noto-mono fonts-noto-cjk fonts-noto-cjk-extra fonts-roboto fonts-roboto-slab fonts-lato fonts-open-sans fonts-quicksand fonts-comfortaa fonts-cantarell fonts-beteckna fonts-ubuntu fonts-linuxlibertine fonts-ebgaramond fonts-ebgaramond-extra fonts-junicode fonts-stix fonts-texgyre fonts-sil-gentium fonts-sil-gentium-basic fonts-hack fonts-firacode fonts-cascadia-code fonts-inconsolata fonts-fantasque-sans fonts-terminus fonts-droid-fallback fonts-symbola fonts-ancient-scripts fonts-mathjax fonts-croscore fonts-nanum fonts-nanum-extra fonts-wqy-microhei fonts-wqy-zenhei fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-gothic fonts-ipafont-mincho fonts-indic fonts-lohit-deva fonts-lohit-beng-assamese fonts-lohit-beng-bengali fonts-lohit-gujr fonts-lohit-guru fonts-lohit-knda fonts-lohit-mlym fonts-lohit-orya fonts-lohit-taml fonts-lohit-taml-classical fonts-lohit-telu fonts-smc fonts-arabeyes fonts-hosny-amiri fonts-sil-abyssinica fonts-beng fonts-thai-tlwg fonts-gfs-artemisia fonts-gfs-baskerville fonts-gfs-bodoni-classic fonts-gfs-didot fonts-gfs-gazis fonts-gfs-neohellenic fonts-gfs-olga fonts-gfs-porson fonts-gfs-solomos fonts-gfs-theokritos fonts-crosextra-carlito fonts-crosextra-caladea fonts-cabin fonts-vollkorn fonts-yanone-kaffeesatz fonts-ibm-plex fonts-freefont-ttf fonts-mplus fonts-monofur fonts-courier-prime fonts-anonymous-pro fonts-hermit + libmagic1 \ + fonts-dejavu fonts-dejavu-core fonts-dejavu-extra fonts-dejavu-mono fonts-liberation fonts-liberation2 fonts-opensymbol fonts-urw-base35 fonts-noto-color-emoji fonts-noto-core fonts-noto-ui-core fonts-noto-extra fonts-noto-mono fonts-noto-cjk fonts-noto-cjk-extra fonts-roboto fonts-roboto-slab fonts-lato fonts-open-sans fonts-quicksand fonts-comfortaa fonts-cantarell fonts-beteckna fonts-ubuntu fonts-linuxlibertine fonts-ebgaramond fonts-ebgaramond-extra fonts-junicode fonts-stix fonts-texgyre fonts-sil-gentium fonts-sil-gentium-basic fonts-hack fonts-firacode fonts-cascadia-code fonts-inconsolata fonts-fantasque-sans fonts-terminus fonts-droid-fallback fonts-symbola fonts-ancient-scripts fonts-mathjax fonts-croscore fonts-nanum fonts-nanum-extra fonts-wqy-microhei fonts-wqy-zenhei fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-gothic fonts-ipafont-mincho fonts-indic fonts-lohit-deva fonts-lohit-beng-assamese fonts-lohit-beng-bengali fonts-lohit-gujr fonts-lohit-guru fonts-lohit-knda fonts-lohit-mlym fonts-lohit-orya fonts-lohit-taml fonts-lohit-taml-classical fonts-lohit-telu fonts-smc fonts-arabeyes fonts-hosny-amiri fonts-sil-abyssinica fonts-beng fonts-thai-tlwg fonts-gfs-artemisia fonts-gfs-baskerville fonts-gfs-bodoni-classic fonts-gfs-didot fonts-gfs-gazis fonts-gfs-neohellenic fonts-gfs-olga fonts-gfs-porson fonts-gfs-solomos fonts-gfs-theokritos fonts-crosextra-carlito fonts-crosextra-caladea fonts-cabin fonts-vollkorn fonts-yanone-kaffeesatz fonts-ibm-plex fonts-freefont-ttf fonts-mplus fonts-monofur fonts-courier-prime fonts-anonymous-pro fonts-hermit \ + && rm -rf /var/lib/apt/lists/* # install Roboto Mono manually (not packaged in Debian, kj_sh604's fave font) RUN apt-get update && apt-get install -y --no-install-recommends curl \ @@ -17,40 +19,27 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl \ && fc-cache -fv \ && rm -rf /var/lib/apt/lists/* -# 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/<VirtualHost \*:80>/<VirtualHost *:3000>/' \ - /etc/apache2/sites-available/*.conf - -# enable mod_rewrite -RUN a2enmod rewrite +WORKDIR /app -# 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 +# install python dependencies +COPY src/requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt # copy entrypoint script COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/docker-entrypoint.sh # copy application -COPY src/ /var/www/html/src/ +COPY src/ /app/ # stash a seed copy of uploads so the entrypoint can populate a fresh volume RUN mkdir -p /opt/uploads-seed \ - && cp -r /var/www/html/src/uploads/. /opt/uploads-seed/ \ - && chown -R www-data:www-data /var/www/html/src/uploads /opt/uploads-seed + && cp -r /app/uploads/. /opt/uploads-seed/ \ + && chown -R www-data:www-data /app/uploads /opt/uploads-seed EXPOSE 3000 -# tini as PID 1 ensures SIGTERM is properly forwarded to apache, +# tini as PID 1 ensures SIGTERM is properly forwarded to gunicorn, # preventing the 'permission denied' error on docker stop ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/docker-entrypoint.sh"] -CMD ["apache2-foreground"]
\ No newline at end of file +CMD ["gunicorn", "--bind", "0.0.0.0:3000", "--workers", "2", "--user", "www-data", "--group", "www-data", "app:app"]
\ No newline at end of file |
