Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ jobs:
--exclude='/.nextcloud' \
--exclude='/docker' \
--exclude='/docker-compose.yml' \
--exclude='/Dockerfile' \
--exclude='/.dockerignore' \
--exclude='/charts' \
--exclude='/docs' \
--exclude='/website' \
--exclude='/node_modules' \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ jobs:
--exclude='/.nextcloud' \
--exclude='/docker' \
--exclude='/docker-compose.yml' \
--exclude='/Dockerfile' \
--exclude='/.dockerignore' \
--exclude='/charts' \
--exclude='/docs' \
--exclude='/website' \
--exclude='/node_modules' \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,9 @@ jobs:
--exclude='/.nextcloud' \
--exclude='/docker' \
--exclude='/docker-compose.yml' \
--exclude='/Dockerfile' \
--exclude='/.dockerignore' \
--exclude='/charts' \
--exclude='/docs' \
--exclude='/docusaurus' \
--exclude='/website' \
Expand Down
20 changes: 20 additions & 0 deletions templates/app-deploy/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Build context for the evaluation image. The image installs vendor/ and
# builds js/ itself, so local dependencies stay out.
# Rendered from ConductionNL/.github templates/app-deploy.
.git
**/node_modules
vendor
coverage
.phpunit.cache
.phpunit.result.cache
tests/e2e/results
playwright-report
test-results
*.log
.env
# The deployment files themselves, so editing them does not rebuild the app.
Dockerfile
.dockerignore
docker-compose*.yml
charts
.github
109 changes: 109 additions & 0 deletions templates/app-deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# syntax=docker/dockerfile:1
#
# Evaluation image for __APP_ID__: the official Nextcloud image with this app,
# built from this repository, and OpenRegister, taken from its release.
#
# docker build -t ghcr.io/conductionnl/__APP_ID__ .
#
# The supported production install is still the Nextcloud App Store. This image
# is for trying the app out, for demos and for test environments.
#
# Rendered from ConductionNL/.github templates/app-deploy. Change the template,
# not this copy, and render it again.
#
# SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>
# SPDX-License-Identifier: EUPL-1.2

# Nextcloud 33 is the newest major whose image still ships PHP 8.3. The 34 and
# 35 images ship PHP 8.5, which some apps in the fleet do not support yet.
ARG NEXTCLOUD_IMAGE=nextcloud:33.0.10-apache
ARG APP_ID=__APP_ID__

# ── Frontend: the same steps the release workflow runs ──
FROM node:22-bookworm-slim AS frontend
WORKDIR /app
COPY . .
# Honour engines.npm: Node 22 bundles npm 10, several apps require npm 11.
RUN set -eu; \
range="$(node -p "((require('./package.json').engines)||{}).npm||''")"; \
if [ -n "$range" ]; then npm install -g "npm@$range"; fi; \
npm ci --no-audit --no-fund; \
npm run build; \
rm -rf node_modules

# ── Backend: runtime composer dependencies only ──
FROM composer:2 AS vendor
WORKDIR /app
COPY --from=frontend /app /app
# The lock was resolved for the app's own platform; the composer image does not
# carry Nextcloud's PHP extensions, so platform checks are left to Nextcloud.
RUN composer install --no-dev --no-interaction --no-progress \
--optimize-autoloader --classmap-authoritative --ignore-platform-reqs

# ── Package: the same file set as the release tarball ──
FROM alpine:3.20 AS package
ARG APP_ID
# hadolint ignore=DL3018
RUN apk add --no-cache rsync
COPY --from=vendor /app /app
RUN mkdir -p "/out/${APP_ID}" && rsync -a \
--exclude='/.git*' --exclude='/.github' --exclude='/.claude' \
--exclude='/.hydra' --exclude='/.vscode' --exclude='/.nextcloud' \
--exclude='/docker' --exclude='/charts' \
--exclude='/Dockerfile' --exclude='/.dockerignore' \
--exclude='/docker-compose*.yml' --exclude='/*-compose.yaml' \
--exclude='/docs' --exclude='/docusaurus' --exclude='/website' \
--exclude='/node_modules' \
--include='/src/' --include='/src/manifest.json' --exclude='/src/*' \
--exclude='/tests' --exclude='/test-scenarios' --exclude='/openspec' \
--exclude='/data' --exclude='/resources' --exclude='/phpcs-custom-sniffs' \
--exclude='/package*.json' --exclude='/composer.*' \
--exclude='/*.config.js' --exclude='/*.config.mjs' --exclude='/*.config.ts' \
--exclude='/php*.xml' --exclude='/psalm.xml' --exclude='/phpstan*' \
--exclude='/sbom.cdx.json' --exclude='/.phpunit*' \
/app/ "/out/${APP_ID}/"

# ── OpenRegister: the newest stable release, checked against its SHA-256 ──
FROM alpine:3.20 AS openregister
ARG APP_ID
# Empty means the newest stable release at build time. Prereleases are refused.
# Pin it for a reproducible build: --build-arg OPENREGISTER_VERSION=2.1.0
ARG OPENREGISTER_VERSION=
SHELL ["/bin/ash", "-euo", "pipefail", "-c"]
# hadolint ignore=DL3018
RUN apk add --no-cache curl jq tar
RUN mkdir -p /out; \
if [ "${APP_ID}" = "openregister" ]; then exit 0; fi; \
version="${OPENREGISTER_VERSION#v}"; \
if [ -z "$version" ]; then \
version="$(curl -fsSL https://api.github.com/repos/ConductionNL/openregister/releases/latest \
| jq -r '.tag_name' | sed 's/^v//')"; \
fi; \
case "$version" in \
''|*-*) echo "OpenRegister '$version' is not a stable release" >&2; exit 1 ;; \
esac; \
base="https://github.com/ConductionNL/openregister/releases/download/v${version}/openregister-${version}.tar.gz"; \
curl -fsSL -o /tmp/or.tar.gz "$base"; \
sha="$(curl -fsSL "${base}.sha256" | cut -d' ' -f1)"; \
echo "${sha} /tmp/or.tar.gz" | sha256sum -c -; \
mkdir /tmp/stage && tar -xzf /tmp/or.tar.gz -C /tmp/stage; \
mv "$(find /tmp/stage -mindepth 1 -maxdepth 1 -type d | head -n 1)" /out/openregister; \
printf '%s sha256:%s\n' "$version" "$sha" > /out/openregister/.image-release

# ── Runtime ──
# hadolint ignore=DL3006
FROM ${NEXTCLOUD_IMAGE}
ARG APP_ID
LABEL org.opencontainers.image.title="${APP_ID}" \
org.opencontainers.image.description="Nextcloud with ${APP_ID} and OpenRegister, for evaluation" \
org.opencontainers.image.source="https://github.com/ConductionNL/${APP_ID}" \
org.opencontainers.image.vendor="Conduction B.V."
# The entrypoint copies these into the custom_apps volume on first start; the
# before-starting hook keeps that copy in step with the image afterwards.
COPY --from=openregister --chown=www-data:www-data /out/ /usr/src/nextcloud/custom_apps/
COPY --from=package --chown=www-data:www-data /out/ /usr/src/nextcloud/custom_apps/
COPY --chmod=0755 docker/entrypoint-hooks/before-starting/ /docker-entrypoint-hooks.d/before-starting/
# Enabled in this order: OpenRegister owns the registers the app declares into.
ENV NEXTCLOUD_IMAGE_APPS="openregister ${APP_ID}"
# Apache starts as root to bind port 80 and serves every request as www-data;
# the entrypoint and its hooks run occ as www-data too.
22 changes: 22 additions & 0 deletions templates/app-deploy/README-section.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Try it with Docker

The repository builds an evaluation image: the official Nextcloud image with __APP_ID__ and OpenRegister installed and enabled. It is meant for trying the app out and for test environments. For production, install the app from the Nextcloud App Store.

```bash
docker compose -f __COMPOSE_FILE__ up -d --build
```

Open http://localhost:8080/apps/__APP_ID__/ and sign in as `admin` with password `admin`. The first start takes a minute or two. Set `NEXTCLOUD_ADMIN_PASSWORD` and `APP_PORT` to change the password and the port; `__COMPOSE_FILE__` lists every setting. `docker compose -f __COMPOSE_FILE__ down -v` removes the stack and its data.

Released versions are published as `ghcr.io/conductionnl/__APP_ID__`, so leaving out `--build` uses the published image.

### Run it on Kubernetes

`charts/__APP_ID__` wraps the official [Nextcloud Helm chart](https://github.com/nextcloud/helm) and runs the same image with PostgreSQL:

```bash
helm dependency build charts/__APP_ID__
helm install __APP_ID__ charts/__APP_ID__ --set nextcloud.nextcloud.host=__APP_ID__.example.org
```

Change the passwords in `charts/__APP_ID__/values.yaml` before you install it anywhere that matters.
37 changes: 37 additions & 0 deletions templates/app-deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# App deployment template

One set of deployment artefacts for every Conduction Nextcloud app, parameterised by the app id only:

| File in the app | What it is |
|---|---|
| `Dockerfile` | Evaluation image: the official Nextcloud image (pinned) with the app built from the repository and OpenRegister from its release, checked against the release SHA-256. Nothing secret is baked in. |
| `.dockerignore` | Keeps local `node_modules` and `vendor` out of the build. |
| `docker/entrypoint-hooks/before-starting/10-image-apps.sh` | Entrypoint hook: on every start, copies a newer baked app over the persistent copy, runs `occ upgrade` when needed and enables OpenRegister and the app. |
| `docker-compose.yml` | Nextcloud from that image, PostgreSQL and Redis, with every setting documented in the file. Written to `docker/docker-compose.yml` instead when the app already has a root `docker-compose.yml`, which is then left alone. |
| `charts/<app>/` | Helm chart over the official [Nextcloud chart](https://github.com/nextcloud/helm), running the same image with PostgreSQL. |
| `.github/workflows/container-image.yml` | Builds and pushes `ghcr.io/conductionnl/<app>` for every release, a stable release as its version and `latest`, a beta or unstable release as `edge`. |

The image is for trying an app out and for test environments. Production installs still come from the Nextcloud App Store, and production Kubernetes runs one Nextcloud with many apps rather than a chart per app.

## Rendering

```bash
templates/app-deploy/render.sh <app-id> <path-to-app-repo>
```

The script checks the id against `appinfo/info.xml`, writes the files above and prints a README section for the app. It only overwrites files it wrote before, so running it again brings an app up to the current template. Change the template here, then render it into the apps; do not edit the copies.

## Checking a render

```bash
docker build -t ghcr.io/conductionnl/<app>:test .
docker compose -f docker-compose.yml config -q
helm dependency build charts/<app> && helm lint charts/<app> && helm template t charts/<app>
```

## Choices

- **Nextcloud 33.** The newest image that still ships PHP 8.3; the 34 and 35 images ship PHP 8.5, which not every app supports yet. Every fleet app supports 32 to 34 or later.
- **OpenRegister version.** The newest stable release at build time, never a prerelease, checked against its published SHA-256. Pass `--build-arg OPENREGISTER_VERSION=<version>` to pin it; the baked version and hash are written to `custom_apps/openregister/.image-release`.
- **Root.** Apache starts as root to bind port 80 and serves every request as `www-data`; the entrypoint and the hook run `occ` as `www-data`.
- **Image visibility.** A new GHCR package is private until an organisation owner makes it public.
2 changes: 2 additions & 0 deletions templates/app-deploy/charts/__APP_ID__/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Fetched by `helm dependency build`; Chart.lock pins the version.
charts/
5 changes: 5 additions & 0 deletions templates/app-deploy/charts/__APP_ID__/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
.git/
*.tgz.prov
*.orig
*.swp
18 changes: 18 additions & 0 deletions templates/app-deploy/charts/__APP_ID__/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Rendered from ConductionNL/.github templates/app-deploy.
apiVersion: v2
name: __APP_ID__
description: Nextcloud with __APP_ID__ and OpenRegister, on the official Nextcloud chart. For evaluation and test environments.
type: application
version: 0.1.0
appVersion: "latest"
home: https://github.com/ConductionNL/__APP_ID__
sources:
- https://github.com/ConductionNL/__APP_ID__
- https://github.com/nextcloud/helm
maintainers:
- name: Conduction B.V.
email: info@conduction.nl
dependencies:
- name: nextcloud
version: 9.4.1
repository: https://nextcloud.github.io/helm/
10 changes: 10 additions & 0 deletions templates/app-deploy/charts/__APP_ID__/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- /* Rendered from ConductionNL/.github templates/app-deploy. */ -}}
__APP_ID__ is starting on Nextcloud (image {{ .Values.nextcloud.image.registry }}/{{ .Values.nextcloud.image.repository }}:{{ .Values.nextcloud.image.tag }}).

The first start installs Nextcloud and enables OpenRegister and __APP_ID__,
which takes a few minutes. Follow it with:

kubectl logs -f -n {{ .Release.Namespace }} deploy/{{ .Release.Name }}-nextcloud

Then open https://{{ .Values.nextcloud.nextcloud.host }}/apps/__APP_ID__/ and sign in as
{{ .Values.nextcloud.nextcloud.username }}.
53 changes: 53 additions & 0 deletions templates/app-deploy/charts/__APP_ID__/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Values for the __APP_ID__ evaluation chart. Everything under `nextcloud:` is
# passed to the official Nextcloud chart; see
# https://github.com/nextcloud/helm/tree/main/charts/nextcloud for all options.
#
# The image is ghcr.io/conductionnl/__APP_ID__: the official Nextcloud image
# with __APP_ID__ and OpenRegister baked in. Its before-starting hook enables
# both apps, so no hook or app list is needed here.
#
# helm dependency build charts/__APP_ID__
# helm install __APP_ID__ charts/__APP_ID__ \
# --set nextcloud.nextcloud.host=__APP_ID__.example.org \
# --set nextcloud.nextcloud.password=<admin password> \
# --set nextcloud.postgresql.global.postgresql.auth.password=<db password>
#
# Rendered from ConductionNL/.github templates/app-deploy.

nextcloud:
image:
registry: ghcr.io
repository: conductionnl/__APP_ID__
# Pin a released version for anything you want to keep.
tag: latest
pullPolicy: IfNotPresent

nextcloud:
host: __APP_ID__.local
username: admin
# Set your own, or point existingSecret at a Secret you manage.
password: changeme

# OpenRegister needs a real database; SQLite is not supported.
internalDatabase:
enabled: false
externalDatabase:
enabled: true
type: postgresql
user: nextcloud
database: nextcloud
postgresql:
enabled: true
global:
postgresql:
auth:
username: nextcloud
password: changeme
database: nextcloud
primary:
persistence:
enabled: true

persistence:
enabled: true
size: 8Gi
Loading
Loading