Support for volume file mounts in one-click-apps
Discussed in https://github.com/caprover/caprover/discussions/2245
Originally posted by nktnet1 January 25, 2025 Hello,
I believe currently, there is no way to create a one-click-app template that comes with a persistent config file mounted in volume, e.g. a python file such as superset_config.py.
For context, I would like to convert the following superset template:
services:
db: .....
redis: .....
superset:
image: amancevice/superset
restart: always
depends_on:
- db
- redis
environment:
MAPBOX_API_KEY: ${MAPBOX_API_KEY}
ports:
- "8088:8088"
volumes:
# Ideally create this file automatically with one-click-apps
- ./superset_config.py:/etc/superset/superset_config.py
In alternatives like Dokploy/Coolify, this is possible using
Would it be possible to implement something similar for Caprover?
Thinking about this a bit more, it's actually doable through a simple hack:
services:
$$cap_appname-delete-me-after-installation:
volumes:
- $$cap-some-volume-name:/mydata
caproverExtra:
dockerfileLines:
- FROM alpine:latest
- RUN mkdir /mydata
- ENV FILE_CONTENT="line 1
- line 2
- line 3"
- RUN echo $'#!/bin/sh\n\
- echo "$FILE_CONTENT" > /mydata/myfile\n\
- tail -f /dev/null' > /startup.sh
- RUN chmod +x /startup.sh
- CMD ["/startup.sh"]
This container creates a file with pre-specified content at a specific volume on start up. The only downside is that user needs to delete this container manually after installation is done.