Spaces:
Paused
Paused
| #FROM langfuse/langfuse:2 | |
| #USER root | |
| ### Install PostgreSQL and necessary dependencies | |
| #RUN apk update && apk add --no-cache \ | |
| # postgresql \ | |
| # postgresql-contrib \ | |
| # net-tools \ | |
| # iproute2 \ | |
| # sed | |
| ### Copy and set up the wrapper script | |
| #COPY docker-entrypoint-wrapper.sh /docker-entrypoint-wrapper.sh | |
| #RUN chmod +x /docker-entrypoint-wrapper.sh | |
| #EXPOSE 3000 | |
| #ENTRYPOINT ["dumb-init", "--", "/docker-entrypoint-wrapper.sh"] | |
| #======================== | |
| ### added from article "create your first docker" | |
| # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker | |
| # you will also find guides on how best to write your Dockerfile | |
| FROM python:3.11-slim | |
| # alpine as a slim python-os option(grok recommended) | |
| #FROM python:3.11-alpine | |
| # The two following lines are requirements for the Dev Mode to be functional | |
| # Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers | |
| #RUN useradd -m -u 1000 user | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| #COPY --chown=user ./requirements.txt requirements.txt | |
| #RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Install uv for faster dependency resolution, then install packages system-wide | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir uv && \ | |
| uv pip install --system --no-cache-dir -r requirements.txt | |
| #COPY --chown=user . /app | |
| #USER user | |
| # Set home to the user's home directory | |
| #ENV HOME=/home/user \ | |
| #PATH=/home/user/.local/bin:$PATH | |
| ## Download Bootstrap | |
| RUN mkdir -p static && \ | |
| curl -o static/bootstrap.min.css https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css && \ | |
| curl -o static/bootstrap.bundle.min.js https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js | |
| # Preload Flan-T5-small (optional, but speeds first load; uses ~250MB) | |
| RUN python -c "from transformers import pipeline; pipeline('text2text-generation', model='google/flan-t5-small')" | |
| # Copy app code last | |
| COPY . . | |
| # Expose port (HF proxies it) | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |
| # "main:app" | |