Skip to content

Commit 3450d62

Browse files
committed
feat: add custom nextcloud dockerfile and github action to publish docker image
1 parent 979936c commit 3450d62

1 file changed

Lines changed: 68 additions & 1 deletion

File tree

README.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,68 @@
1-
# nextcloud-docker
1+
# docker-nextcloud
2+
3+
Custom Nextcloud Docker image that bakes the application code into the image,
4+
eliminating the rsync-on-startup pattern of the official image. Designed for Kubernetes
5+
deployments on NFS storage.
6+
7+
## Key differences from the official image
8+
9+
- **No `VOLUME /var/www/html`** — the application code lives in the image layer. Only
10+
user-data directories (`config`, `data`, `custom_apps`, `themes`) are declared as
11+
volumes.
12+
- **No rsync at startup** — code is copied at build time, not at runtime.
13+
- **Supports both Community and Enterprise** — select the edition via build args.
14+
- **Post-upgrade DB optimization** — runs `maintenance:repair`,
15+
`db:add-missing-indices`, and related commands automatically after each upgrade
16+
(opt-out via `NEXTCLOUD_SKIP_DATABASE_OPTIMIZATION=yes`).
17+
- **Subscription key support** — set `SUBSCRIPTION_KEY` to configure the enterprise
18+
support app.
19+
20+
## Build arguments
21+
22+
| Argument | Default | Description |
23+
| ------------------------ | --------------------- | ----------------------------------------------------------------------------------- |
24+
| `NEXTCLOUD_VERSION` | *(set in Dockerfile)* | Version to download (community) |
25+
| `ENTERPRISE_ARCHIVE_URL` | *(set in Dockerfile)* | If set, downloads the enterprise ZIP from this URL instead of the community tarball |
26+
27+
## Volumes
28+
29+
Only user-generated data needs to persist across image updates:
30+
31+
| Path | Content |
32+
| --------------------------- | -------------------------------------------- |
33+
| `/var/www/html/config` | Nextcloud configuration (`config.php`, etc.) |
34+
| `/var/www/html/data` | User files |
35+
| `/var/www/html/custom_apps` | User-installed apps |
36+
| `/var/www/html/themes` | Custom themes |
37+
38+
## Environment variables
39+
40+
Additional variables introduced by this image:
41+
42+
| Variable | Default | Description |
43+
| -------------------------------------- | --------- | ---------------------------------------------------------- |
44+
| `NEXTCLOUD_SKIP_DATABASE_OPTIMIZATION` | `no` | Set to `yes` to skip post-upgrade DB optimization commands |
45+
| `SUBSCRIPTION_KEY` | *(unset)* | Enterprise subscription key for the `support` app |
46+
47+
## Upgrade behaviour
48+
49+
The entrypoint detects the installed version from `config/version.php` (written after
50+
each successful install or upgrade) and compares it to the version baked in the image.
51+
52+
- **Fresh install** (`config/version.php` absent): runs `occ maintenance:install`, then
53+
writes the sentinel.
54+
- **Upgrade** (image version > installed version): runs `occ upgrade`, DB optimizations,
55+
then updates the sentinel.
56+
- **Downgrade**: refused with an error.
57+
- **Cross-replica safety**: the init block is protected by `flock` on
58+
`config/nextcloud-init-sync.lock` (on the shared `config` volume).
59+
60+
## Files
61+
62+
- `Dockerfile` — multi-stage build (`source` on alpine, `final` on
63+
`php:8.4-apache-trixie`)
64+
- `docker-entrypoint.sh` — install/upgrade logic, structurally identical to the official
65+
community entrypoint
66+
- `cron.sh` — runs `busybox crond` for background jobs
67+
- `config/` — default PHP config files baked into the image; also copied to
68+
`/usr/src/nextcloud-config/` as a reference for drift detection warnings at startup

0 commit comments

Comments
 (0)