Skip to content

Commit

Permalink
docs: add docker example
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Mar 22, 2024
1 parent 0ab5874 commit bea445f
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .examples/Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ==========================================================
# Please see docker-compose.yml for usage information
# ==========================================================

FROM nextcloud:28-fpm

RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
ffmpeg \
libmagickcore-6.q16-6-extra \
procps \
supervisor \
; \
rm -rf /var/lib/apt/lists/*

# php-fpm configuration
RUN echo 'pm.max_children = 16' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \
echo 'pm.max_spare_servers = 8' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \
echo 'pm.start_servers = 8' >> /usr/local/etc/php-fpm.d/zz-docker.conf

# Enable PHP 8 JIT
RUN { \
echo 'opcache.jit=1255'; \
echo 'opcache.jit_buffer_size=256M'; \
} >> "${PHP_INI_DIR}/conf.d/opcache-recommended.ini";

# Add preview generation cron job
RUN echo '*/6 * * * * php -f /var/www/html/occ preview:pre-generate' >> /var/spool/cron/crontabs/www-data

RUN mkdir -p \
/var/log/supervisord \
/var/run/supervisord \
;

COPY supervisord.conf /

ENV NEXTCLOUD_UPDATE=1

CMD /usr/bin/supervisord -c /supervisord.conf
102 changes: 102 additions & 0 deletions .examples/Docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# ===================================================================================================================
# READ THIS NOTICE BEFORE YOU PROCEED
# ===================================================================================================================
# This is an example docker compose file for running Nextcloud with Memories.
# This file is provided as an example only and is not intended to be used as-is.
# You will need all files in this directory for the example to work.
#
# 1. Make sure all placeholders are replaced with the correct values.
# 2. Choose a strong password for the database.
# 3. Use an appropriate nginx.conf, and adjust it according to your needs.
# If you intend to use a second reverse proxy for TLS, you can use this example:
# https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/insecure/mariadb/fpm/web/nginx.conf
# In the example below, Nextcloud will be exposed on port 8500
# 4. Make sure the Dockerfile uses the Nextcloud version you want to see (first line)
# 5. Tune the PHP-FPM parameters in the Dockerfile according to your hardware
# 6. The preview generator cron job is pre-configured, but you still need to install the app
# and do the initial generation run. https://github.com/nextcloud/previewgenerator
# ===================================================================================================================

version: '3.5'

services:
db:
image: mariadb:11
restart: always
pull_policy: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- /ssd/nextcloud_mariadb:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=my_root_password
- MYSQL_PASSWORD=my_password
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MARIADB_AUTO_UPGRADE=1
- MARIADB_INITDB_SKIP_TZINFO=1

redis:
image: redis:alpine
pull_policy: always
restart: always

app:
build: .
restart: always
depends_on:
- db
- redis
volumes:
- /ssd/nextcloud:/var/www/html
- /hdd/nextcloud_data:/var/www/html/data

# Once Nextcloud is installed, you may move the app data folder to a faster storage
# and mount it here. This is optional, but recommended for better performance.
# The <instanceid> will depend on the particular Nextcloud instance.
# You will then need to make the same change in the cron service below.
# - /ssd/nc_appdata_<instanceid>:/var/www/html/data/appdata_<instanceid>
environment:
- NEXTCLOUD_TRUSTED_DOMAINS=my.nextcloud.domain
- TZ=America/Los_Angeles
- MYSQL_PASSWORD=my_password
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
- REDIS_HOST=redis
- OVERWRITEPROTOCOL=https
- PHP_MEMORY_LIMIT=1G
- PHP_UPLOAD_LIMIT=12G
- DEBIAN_FRONTEND=noninteractive

web:
image: nginx:alpine
pull_policy: always
restart: always
depends_on:
- app
ports:
- 127.0.0.1:8500:80
volumes:
- /ssd/nextcloud:/var/www/html:ro
- ./nginx.conf:/etc/nginx/nginx.conf:ro

go-vod:
image: radialapps/go-vod
pull_policy: always
restart: always
depends_on:
- app
environment:
- NEXTCLOUD_HOST=https://your-nextcloud-url
# - NEXTCLOUD_ALLOW_INSECURE=1 # (self-signed certs or no HTTPS)
- NVIDIA_VISIBLE_DEVICES=all

volumes:
- /hdd/nextcloud_data:/var/www/html/data:ro

# Uncomment the following lines for QSV / VA-API:
# devices:
# - /dev/dri:/dev/dri

# Uncomment the following lines for NVENC
# runtime: nvidia
22 changes: 22 additions & 0 deletions .examples/Docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[supervisord]
nodaemon=true
logfile=/var/log/supervisord/supervisord.log
pidfile=/var/run/supervisord/supervisord.pid
childlogdir=/var/log/supervisord/
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error

[program:php-fpm]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php-fpm

[program:cron]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/cron.sh

0 comments on commit bea445f

Please sign in to comment.