For those interested, I’ve got a nice, working nextcloud installation, running under Dockge.
It sets up nextcloud with the ability to connect to an smb share (which nextcloud doesn’t do out of the box), and also automatically sets up HSTS in apache2.conf so you don’t get the annoying warning on the “Security & setup warnings” page.
To update when a new version of nextcloud is released, simply update the version number (e.g. 31.0.9) in the dockerfile and compose.yaml. Then open Dockge, go to <_Console in the top right, and in Dockge’s console, navigate to your nextcloud stack’s directory and run “docker compose build --no-cache”. Then, “update” and “restart” your stack using Dockge’s GUI.
For the files below, obviously adjust your TrueNAS IP, ports, mountpoints and passwords as needed.
compose.yaml:
services:
db:
image: mariadb:10.11
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
restart: unless-stopped
volumes:
- ./db:/var/lib/mysql:Z
environment:
- MYSQL_ROOT_PASSWORD=changeme
- MARIADB_AUTO_UPGRADE=1
- MARIADB_DISABLE_UPGRADE_BACKUP=1
env_file:
- db.env
redis:
image: redis:alpine
restart: unless-stopped
app:
build: .
restart: unless-stopped
ports:
- 192.168.1.2:8089:80
volumes:
- ./nextcloud:/var/www/html:z
environment:
- MYSQL_HOST=db
- REDIS_HOST=redis
- PHP_MEMORY_LIMIT=1024M
- PHP_UPLOAD_LIMIT=1024M
env_file:
- db.env
depends_on:
- db
- redis
cron:
image: nextcloud:31.0.9
restart: unless-stopped
volumes:
- ./nextcloud:/var/www/html:z
entrypoint: /cron.sh
depends_on:
- db
- redis
volumes:
db: null
nextcloud: null
networks: {}
dockerfile:
FROM nextcloud:31.0.9
RUN apt update && apt install -y smbclient libsmbclient-dev nano sudo && rm -rf /var/lib/apt/lists/*
RUN pecl install smbclient
RUN docker-php-ext-enable smbclient
RUN { \
echo '<IfModule mod_headers.c>'; \
echo ' Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"'; \
echo ' Header set Referrer-Policy "no-referrer"'; \
echo '</IfModule>'; \
} >> "/etc/apache2/apache2.conf"
and finally, db.env:
MYSQL_PASSWORD=changeme
MYSQL_DATABASE=nextcloud
MYSQL_USER=nextcloud