helicone / Dockerfile
bibibi12345's picture
initial
37ba690
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /code
# Copy the dependencies file to the working directory
COPY ./requirements.txt /code/requirements.txt
# Install any needed dependencies specified in requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the rest of the application code to the working directory
COPY ./app.py /code/app.py
# .env file will be handled by docker-compose for local dev, or secrets in HF
# Make port 8000 available to the world outside this container
# Hugging Face Spaces expects the app to listen on port 7860 by default for Docker,
# but we can configure it. Let's stick to 8000 as defined in app.py and uvicorn command.
# If HF requires 7860, we'll need to adjust the uvicorn command and EXPOSE.
# Let's keep 8000 for now and check HF docs if issues arise. Or we can make it 7860 explicitly.
# Let's change to 7860 to be safe with HF defaults.
EXPOSE 7860
# Define environment variable for the port (optional, uvicorn command specifies it)
# ENV PORT=7860
# Run app.py when the container launches using uvicorn
# Use 0.0.0.0 to ensure it's accessible from outside the container
# Change port to 7860 to match Hugging Face Docker convention
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]