-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
395 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
# My php-fpm image, based on debian Linux, configured and forked from the | ||
# official Nextcloud docker repository. | ||
# @see: https://github.com/nextcloud/docker/blob/09fecda4067434c11f955cdd3000ed950fe48d04/27/fpm/Dockerfile | ||
FROM php:8.3-fpm | ||
|
||
LABEL org.opencontainers.image.title="llaumgui/php-fpm" | ||
LABEL org.opencontainers.image.description="Fork of php-fpm:8.3 based on Nextcloud" | ||
LABEL org.opencontainers.image.vendor="Guillaume Kulakowski" | ||
LABEL org.opencontainers.image.authors="[email protected]" | ||
LABEL org.opencontainers.image.licenses="MIT" | ||
LABEL org.opencontainers.image.version="8.3" | ||
|
||
# Need by pageres | ||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true | ||
ENV CHROMIUM_PATH /usr/bin/chromium | ||
|
||
# Fix hadolint #DL4006 (https://github.com/hadolint/hadolint/wiki/DL4006) | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
|
||
# ----------------------------------------------------------------- Install cron | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
busybox-static && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
mkdir -p /var/spool/cron/crontabs | ||
COPY --chmod=755 cron/www-data /var/spool/cron/crontabs/ | ||
COPY --chmod=755 cron/*.sh / | ||
|
||
|
||
# ------------------------------------------------------------------ Supervisord | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
# Install supervisor to start multiple processes on container startup \ | ||
supervisor&& \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
RUN mkdir "/var/run/supervisor" | ||
RUN rm -rf /etc/supervisor/* | ||
COPY supervisor/*.conf /etc/supervisor | ||
COPY supervisor/*.sh / | ||
|
||
|
||
# --------------------------------------------- Install Search and LLM utilities | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
# Install tesseract and ocrmypdf for OCR \ | ||
tesseract-ocr \ | ||
tesseract-ocr-fra \ | ||
tesseract-ocr-eng \ | ||
ocrmypdf \ | ||
# Install Python for Local Large language model \ | ||
python-is-python3 \ | ||
python3-venv && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
# ------------------------------------------------------- Install misc utilities | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
bzip2 \ | ||
curl \ | ||
chromium \ | ||
ffmpeg \ | ||
git \ | ||
gnupg \ | ||
imagemagick \ | ||
libfcgi-bin \ | ||
libldap-common \ | ||
libmagickwand-6.q16-6 \ | ||
libmagickcore-6.q16-6-extra \ | ||
libpng16-16 \ | ||
libpq5 \ | ||
libzip4 \ | ||
nodejs \ | ||
npm \ | ||
openssl \ | ||
procps \ | ||
rsync \ | ||
unzip \ | ||
wget && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
# --------------------------------------------------------- Install dependancies | ||
RUN fetchDeps=" \ | ||
# Dependency for bz2 \ | ||
libbz2-dev \ | ||
# Dependencies for gd \ | ||
libfreetype6-dev \ | ||
libjpeg-dev\ | ||
libpng-dev \ | ||
libwebp-dev \ | ||
# Build dependency for gmp \ | ||
libgmp-dev \ | ||
# Build dependency for imagick \ | ||
libmagickwand-dev \ | ||
# Build dependency for intl \ | ||
libicu-dev \ | ||
# Build dependency for ldap \ | ||
libldap2-dev \ | ||
# Build dependency for mbstring \ | ||
libonig-dev\ | ||
# Build dependancies for PostgreSQL \ | ||
libpq-dev \ | ||
# Build dependencies for XML part \ | ||
libxml2-dev \ | ||
# Build dependencies for Zip \ | ||
libzip-dev \ | ||
# Misc build dependencies \ | ||
libcurl4-openssl-dev \ | ||
libevent-dev \ | ||
libmcrypt-dev \ | ||
libpq-dev \ | ||
zlib1g-dev" ; \ | ||
apt-get update ; \ | ||
apt-get install --no-install-recommends -y ${fetchDeps}; \ | ||
\ | ||
\ | ||
# ------------------------------------------------------- Install php extensions \ | ||
php -m; \ | ||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ | ||
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \ | ||
docker-php-ext-configure ldap --with-libdir="lib/${debMultiarch}"; \ | ||
docker-php-ext-install -j "$(nproc)" \ | ||
bcmath \ | ||
bz2 \ | ||
exif \ | ||
gd \ | ||
gettext \ | ||
gmp \ | ||
intl \ | ||
ldap \ | ||
mbstring \ | ||
opcache \ | ||
pcntl \ | ||
pdo_pgsql \ | ||
pgsql \ | ||
shmop \ | ||
soap \ | ||
sysvsem \ | ||
zip; \ | ||
php -m; \ | ||
\ | ||
\ | ||
# ------------------------------------------------------ Install pecl extensions \ | ||
php -m && \ | ||
pecl install apcu && \ | ||
pecl install igbinary && \ | ||
#pecl install imagick && \ | ||
# Tempory workaround - BEGIN \ | ||
git clone https://github.com/Imagick/imagick.git --depth 1 /tmp/imagick && \ | ||
cd /tmp/imagick && \ | ||
git fetch origin master && \ | ||
git switch master && \ | ||
cd /tmp/imagick && \ | ||
phpize && \ | ||
./configure && \ | ||
make && \ | ||
make install && \ | ||
# Tempory workaround - END \ | ||
pecl install redis \ | ||
--configureoptions 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"' && \ | ||
docker-php-ext-enable \ | ||
igbinary \ | ||
apcu \ | ||
imagick \ | ||
redis && \ | ||
rm -r /tmp/pear; \ | ||
php -m ; \ | ||
\ | ||
\ | ||
# ------------------------------------------------------------------ Big cleanup \ | ||
npm install -g pageres-cli && \ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ${fetchDeps}; \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* \ | ||
/tmp/* \ | ||
/var/tmp/* \ | ||
/usr/share/doc/* | ||
|
||
|
||
# -------------------------------------------------- Install php-fpm-healthcheck | ||
RUN sed -i 's#^;pm.status_path = .*#pm.status_path = /status#g' /usr/local/etc/php-fpm.d/www.conf && \ | ||
wget --progress=dot:giga -O /usr/local/bin/php-fpm-healthcheck https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck && \ | ||
chmod +x /usr/local/bin/php-fpm-healthcheck && \ | ||
wget --progress=dot:giga -O /usr/local/bin/cachetool https://github.com/gordalina/cachetool/releases/latest/download/cachetool.phar && \ | ||
chmod +x /usr/local/bin/cachetool | ||
|
||
|
||
# ---------------------------------------------------------------- Configuration | ||
# My configuration. | ||
COPY php.d /usr/local/etc/php/conf.d | ||
COPY etc /usr/local/etc/php | ||
|
||
# Patch | ||
COPY patch /tmp | ||
RUN cd /usr/local/lib/node_modules/pageres-cli && patch -p0 < /tmp/pageres.patch && rm -f /tmp/pageres.patch | ||
|
||
# Remove access log | ||
RUN sed -i 's#^access.log = /proc/self/fd/2#access.log = /dev/null#g' /usr/local/etc/php-fpm.d/docker.conf | ||
|
||
# Healthcheck | ||
HEALTHCHECK --interval=1m --timeout=10s --start-period=1m --retries=3 CMD FCGI_CONNECT=localhost:9000 php-fpm-healthcheck | ||
|
||
EXPOSE 9000 | ||
WORKDIR /var/www | ||
|
||
ENTRYPOINT [] | ||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# PHP 8.3-nextcloud (PHP-FPM) on Debian (GLibC) | ||
|
||
[![Author][ico-twitter]][link-twitter] | ||
[![Build Status][ico-ghactions]][link-ghactions] | ||
[![Docker Pull][ico-docker]][link-docker] | ||
[![Latest Version][ico-version]][link-docker] | ||
[![Software License][ico-license]](LICENSE) | ||
|
||
PHP 8.3-nextcloud image: | ||
|
||
* Based on [official Nextcloud](https://github.com/nextcloud/docker/blob/09fecda4067434c11f955cdd3000ed950fe48d04/27/fpm/Dockerfile) (nextcloud:fpm). | ||
* Use Debian with GLibC for [reconize](https://github.com/nextcloud/recognize) with **native speed mode**. | ||
* Use [Supervisor](http://supervisord.org/) to launch several process. | ||
* Implement cron. | ||
* Implement [Healthcheck](https://healthchecks.io/). | ||
* Nextcloud cron every 5mn (use Healthcheck: `HEALTHCHECKS_NC_URL`). | ||
* Auto-update extensions (use Healthcheck: `HEALTHCHECKS_UPDATE_URL`) if `NC_EXT_UPDATE` is defined. | ||
* Add [Full text search](https://apps.nextcloud.com/apps/fulltextsearch) support: | ||
* Install [Tesseract](https://github.com/tesseract-ocr/tesseract) and [OCRmyPDF](https://ocrmypdf.readthedocs.io/en/latest/) for OCR. | ||
* Run `occ:fulltextsearch:live` to auto index new contents. | ||
* Additionals PHP extensions: | ||
* intl. | ||
* Additionals binaries: | ||
* GIT. | ||
* [php-fpm-healthcheck](https://github.com/renatomefi/php-fpm-healthcheck). | ||
* Python and python3-venv for [Local Large language model](https://apps.nextcloud.com/apps/llm). | ||
* Some configuration: | ||
* A dedicated php-cli.ini. | ||
|
||
## Usage | ||
|
||
### With docker client | ||
|
||
You can run this container with docker client: | ||
|
||
~~~bash | ||
docker run -d \ | ||
--volumes /docker/volumes/www:/var/www \ | ||
--expose 9000 \ | ||
llaumgui/php:8.3-nextcloud | ||
~~~ | ||
|
||
### With compose | ||
|
||
You can use this container in a docker-compose.yml file: | ||
|
||
~~~yaml | ||
php83: | ||
container_name: php83 | ||
image: llaumgui/php:8.3-nextcloud | ||
restart: always | ||
environment: | ||
TZ: 'Europe/Paris' | ||
HEALTHCHECKS_NC_URL: 'https://healthchecks.io/ping/c6ff4460-abc7-41ce-8e33-a671f17b9319' | ||
volumes: | ||
- /var/www:/var/www | ||
expose: | ||
- 9000 | ||
~~~ | ||
|
||
[ico-twitter]: https://img.shields.io/static/v1?label=Author&message=llaumgui&color=000&logo=x&style=flat-square | ||
[link-twitter]: https://twitter.com/llaumgui | ||
[ico-docker]: https://img.shields.io/docker/pulls/llaumgui/php?color=%2496ed&logo=docker&style=flat-square | ||
[link-docker]: https://hub.docker.com/r/llaumgui/php | ||
[ico-ghactions]: https://img.shields.io/github/actions/workflow/status/llaumgui/docker-images-php-fpm/devops.yml?branch=main&style=flat-square&logo=github&label=CI/CD | ||
[link-ghactions]: https://github.com/llaumgui/docker-images-php-fpm/actions | ||
[ico-version]: https://img.shields.io/docker/v/llaumgui/php?sort=semver&color=%2496ed&logo=docker&style=flat-square | ||
[ico-license]: https://img.shields.io/github/license/llaumgui/docker-images-php-fpm?style=flat-square |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
exec busybox crond -f -l 0 -L /dev/stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
if [ -n "${NC_EXT_UPDATE}" ]; then | ||
if [ -z "${HEALTHCHECKS_UPDATE_URL}" ]; then | ||
php -f /var/www/occ app:update --all | ||
else | ||
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_UPDATE_URL}/start && \ | ||
php -f /var/www/occ app:update --all && \ | ||
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_UPDATE_URL} | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
if [ -z "${HEALTHCHECKS_NC_URL}" ]; then | ||
php -f /var/www/cron.php | ||
else | ||
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_NC_URL}/start && \ | ||
php -f /var/www/cron.php && \ | ||
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_NC_URL} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
if [ -d /var/www/apps/previewgenerator ]; then | ||
if [ -z "${HEALTHCHECKS_PREVIEW_URL}" ]; then | ||
php -f /var/www/occ preview:pre-generate | ||
else | ||
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_PREVIEW_URL}/start && \ | ||
php -f /var/www/occ preview:pre-generate && \ | ||
curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHCHECKS_PREVIEW_URL} | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*/5 * * * * /cron_nextcloud.sh | ||
*/10 * * * * /cron_preview.sh | ||
5 4 * * * /cron_ext_update.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[PHP] | ||
memory_limit=2048M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- cli.js 2024-09-20 11:47:51.746178276 +0200 | ||
+++ cli-new.js 2024-09-20 11:48:37.388920896 +0200 | ||
@@ -95,6 +95,11 @@ | ||
async function generate(arguments_, options) { | ||
const pageres = new Pageres({ | ||
incrementalName: !options.overwrite, | ||
+ launchOptions: { | ||
+ executablePath: process.env.CHROMIUM_PATH, | ||
+ args: ['--no-sandbox'], | ||
+ headless: 'new', | ||
+ } | ||
}) | ||
.destination(process.cwd()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
apc.enable_cli=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
apc.serializer=igbinary | ||
session.serialize_handler=igbinary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
; https://docs.nextcloud.com/server/21/admin_manual/installation/server_tuning.html | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.interned_strings_buffer=64 | ||
opcache.max_accelerated_files=10000 | ||
opcache.memory_consumption=256 | ||
opcache.save_comments=1 | ||
opcache.revalidate_freq=60 | ||
opcache.validate_timestamps = 0 | ||
|
||
; JIT (Just In Time) | ||
opcache.jit_buffer_size=8M | ||
opcache.jit=1225 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[PostgreSQL] | ||
pgsql.allow_persistent = On | ||
pgsql.auto_reset_persistent = Off | ||
pgsql.max_persistent = -1 | ||
pgsql.max_links = -1 | ||
pgsql.ignore_notice = 0 | ||
pgsql.log_notice = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
expose_php = Off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
# If fulltextsearch is present: stop all running indexes before start live. | ||
[ -d /var/www/apps/fulltextsearch ] && php /var/www/occ fulltextsearch:stop | ||
|
||
# If fulltextsearch is present: start live index | ||
[ -d /var/www/apps/fulltextsearch ] && php /var/www/occ fulltextsearch:live |
Oops, something went wrong.