Pre-download apps in Docker

I’m wanting to build a custom Docker image that has certain apps downloaded (but not enabled). From the documentation:
sudo -u www-data php occ app:install --keep-disabled twofactor_totp

However, app:install isn’t defined. I assume this is because the database isn’t available?

I saw the following thread:

I’m not sure how I can use this to pre-download (but not install) something like, say, riotchat (Element) via a Dockerfile. Is this something that can be done?

the challenge you are facing is, that nextcloud isn’t installed with the Dockerfile but with the script.

so during the image creation there is no /var/www/html created that contains a nextcloud directory structure.

you could try to download the app directly from github in the Dockerfile without occ.

but i’m not sure what consequences this will have. one i can think about is that you will run into trouble if you update this app in the container but not in the image.

and if you use a volume for /var/www/html in the container /var/www/html/apps will be empty. because it will be overwriten by the volume. but i’m sure about this.

anyhow: don’t do this. use docker exec -u www-data install the app after you start the container.

p.s: last idea - what about creating your own nextcloud.tar.gz that includes the app already?

Ohhhhhhh - I wondered why everything was in /usr/src and how the heck that was working with Apache. I didn’t look closely enough at the

Does occ app:install not work just because the DB isn’t running? That’s somewhat annoying since the DB isn’t required for --keep-disabled.

I completely forgot about being able to download and parse the download links. I was trying to figure out how to find a location that would point me to all available apps and where to download them. That solves it for me - thanks!