Langfuse-demo / Dockerfile
InnoLink's picture
Update Dockerfile
f492b98 verified
raw
history blame
2.23 kB
#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 \
# libpq-dev
### 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
# Install curl and ca-certificates (ca-certificates might already be installed, but it's safe to include)
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*
# 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 .
# Install uv for faster dependency resolution, then install packages system-wide
RUN pip install --no-cache-dir uv --root-user-action ignore && \
#pip install --no-cache-dir uv && \
uv pip install --system --no-cache-dir -r requirements.txt
## 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')"
#&& \
#python -c "from datasets import load_dataset; load_dataset('squad', split='train[:1%]')"
# Copy app code last
#COPY app/static
COPY . .
#Persistent Storage: Enable in HF Settings > Persistent Storage (request 5-10GB free tier)
#VOLUME ["/data"]
# Expose port (HF proxies it)
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]