Langfuse-demo / Dockerfile
InnoLink's picture
Update Dockerfile
0a337b2 verified
#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
WORKDIR /app
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
curl \
ca-certificates \
git \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt ./
# Install uv for faster dependency resolution, then install packages system-wide
RUN pip3 install --no-cache-dir uv --root-user-action ignore && \
uv pip install --system --no-cache-dir -r requirements.txt
## Download Bootstrap
#RUN 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
# add-fontawesome-here
# 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 static/ ./static/
COPY src/ ./src/
#COPY . .
#Persistent Storage: Enable in HF Settings > Persistent Storage (request 5-10GB free tier)
#VOLUME ["/data"]
# Expose port (HF proxies it)
EXPOSE 1300
CMD ["uvicorn", "run", "app/src/app.py", "--server.port=1300", "--server.address=0.0.0.0"]
ENTRYPOINT ["app/static/index.HTML"]
#ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=1300", "--server.address=0.0.0.0"]
# from streamlit example
#EXPOSE 8501
#CMD streamlit run app.py \
#--server.headless true \
#--server.enableCORS false \
#--server.enableXsrfProtection false \
#--server.fileWatcherType none