Download Dockerfile from maxxcarl/pool: direct link, hf CLI and curl.
- Browser
- Download file 2.44 kB
-
https://huggingface.co/spaces/maxxcarl/pool/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/maxxcarl/pool/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/maxxcarl/pool/resolve/main/Dockerfile
2.44 kB
| # Hugging Face Spaces (Docker SDK) - FastAPI + Uvicorn + Redis + MongoDB + MinIO | |
| # Docs: https://huggingface.co/docs/hub/spaces-sdks-docker | |
| FROM python:3.12-slim | |
| # Install dependencies | |
| RUN apt-get update && apt-get install -y redis-server gnupg wget curl && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Install MongoDB (using apt-get with insecure repo for bookworm compatibility) | |
| RUN curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor && \ | |
| echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg trusted=yes ] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list && \ | |
| apt-get update && \ | |
| apt-get install -y mongodb-org && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Install MinIO | |
| RUN wget -q https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/local/bin/minio && \ | |
| chmod +x /usr/local/bin/minio | |
| # Create a non-root user matching HF Spaces expectations | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # uv installs binaries into ~/.local/bin | |
| ENV PATH="/home/user/.local/bin:/app/.venv/bin:$PATH" | |
| ENV CHROMA_DB_HOST_IP="127.0.0.1" | |
| ENV ANONYMIZED_TELEMETRY="false" | |
| ENV REDIS_HOST="127.0.0.1" | |
| ENV REDIS_PORT="6379" | |
| ENV REDIS_DB="0" | |
| ENV CACHE_TTL="300" | |
| ENV MONGO_URI="mongodb://127.0.0.1:27017" | |
| ENV MONGO_DB_NAME="music_memories" | |
| ENV MINIO_ENDPOINT="127.0.0.1:9000" | |
| ENV MINIO_ACCESS_KEY="minioadmin" | |
| ENV MINIO_SECRET_KEY="minioadmin" | |
| ENV MINIO_BUCKET="music-memories" | |
| ENV MINIO_SECURE="false" | |
| WORKDIR /app | |
| # Install uv (dependency manager) | |
| RUN pip install --no-cache-dir --upgrade uv | |
| # Copy lockfiles first for better Docker layer caching | |
| COPY --chown=user pyproject.toml uv.lock README.md /app/ | |
| # Create venv and install locked dependencies | |
| RUN uv venv /app/.venv \ | |
| && uv sync --frozen --no-dev | |
| # Copy the rest of the app | |
| COPY --chown=user . /app | |
| # Ensure data directories exist and are writable | |
| RUN mkdir -p /app/chroma_db /app/data /app/redis_data /app/mongo_data /app/minio_data && \ | |
| chown -R user:user /app/chroma_db /app/data /app/redis_data /app/mongo_data /app/minio_data | |
| # Seed the database (consistent data in every container) | |
| RUN uv run python seed_db.py | |
| # Copy startup script | |
| COPY --chown=user start.sh /app/start.sh | |
| RUN chmod +x /app/start.sh | |
| EXPOSE 7860 6379 27017 9000 9001 | |
| # Start Redis, MongoDB, MinIO and the app using startup script | |
| CMD ["/app/start.sh"] | |