Spaces:
Sleeping
Sleeping
Kennedy Johnson Cursor commited on
Commit ·
8fc16a2
1
Parent(s): 71de506
fix HF writable data directory
Browse filesCo-authored-by: Cursor <cursoragent@cursor.com>
- Dockerfile +2 -2
- README.md +1 -1
Dockerfile
CHANGED
|
@@ -42,13 +42,13 @@ RUN apt-get update && \
|
|
| 42 |
# HF Spaces runs the container as uid 1000 and expects the app to do the
|
| 43 |
# same; with a non-root user we cannot bind privileged ports, but :7860 is
|
| 44 |
# fine.
|
| 45 |
-
RUN useradd -m -u 1000 user
|
| 46 |
USER user
|
| 47 |
ENV HOME=/home/user \
|
| 48 |
PATH=/home/user/.local/bin:$PATH \
|
| 49 |
PYTHONUNBUFFERED=1 \
|
| 50 |
CORS_ORIGINS=* \
|
| 51 |
-
DATA_DIR=/data \
|
| 52 |
CONFIG_PATH=/home/user/app/muscle_growth_config.yaml
|
| 53 |
|
| 54 |
WORKDIR $HOME/app
|
|
|
|
| 42 |
# HF Spaces runs the container as uid 1000 and expects the app to do the
|
| 43 |
# same; with a non-root user we cannot bind privileged ports, but :7860 is
|
| 44 |
# fine.
|
| 45 |
+
RUN useradd -m -u 1000 user && mkdir -p /home/user/data && chown user:user /home/user/data
|
| 46 |
USER user
|
| 47 |
ENV HOME=/home/user \
|
| 48 |
PATH=/home/user/.local/bin:$PATH \
|
| 49 |
PYTHONUNBUFFERED=1 \
|
| 50 |
CORS_ORIGINS=* \
|
| 51 |
+
DATA_DIR=/home/user/data \
|
| 52 |
CONFIG_PATH=/home/user/app/muscle_growth_config.yaml
|
| 53 |
|
| 54 |
WORKDIR $HOME/app
|
README.md
CHANGED
|
@@ -18,7 +18,7 @@ This Space ships as a single Docker image built from the repository root [`Docke
|
|
| 18 |
|
| 19 |
1. Builds the React frontend at image-build time with `REACT_APP_API_URL=""` so every `fetch` uses relative URLs.
|
| 20 |
2. Serves the bundled SPA from FastAPI at `/`, with the API on `/api/...`, `/auth/...`, etc., on the same `:7860` origin.
|
| 21 |
-
3. Persists user data in **SQLite via `aiosqlite`** at `${DATA_DIR}/`. Mount a Hugging Face Storage Bucket
|
| 22 |
|
| 23 |
### Required Space secrets
|
| 24 |
|
|
|
|
| 18 |
|
| 19 |
1. Builds the React frontend at image-build time with `REACT_APP_API_URL=""` so every `fetch` uses relative URLs.
|
| 20 |
2. Serves the bundled SPA from FastAPI at `/`, with the API on `/api/...`, `/auth/...`, etc., on the same `:7860` origin.
|
| 21 |
+
3. Persists user data in **SQLite via `aiosqlite`** at `${DATA_DIR}/` (default `/home/user/data` in the Docker image). Mount a Hugging Face Storage Bucket there to survive Space rebuilds.
|
| 22 |
|
| 23 |
### Required Space secrets
|
| 24 |
|