travelling-agent / Dockerfile
MUHAMMAD YOUSAF RANA
initial files uploaded
1626f55
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy the requirements file into the container at /app
COPY requirements.txt .
# Install any needed packages specified in requirements.txt
# --no-cache-dir: Don't store the downloaded packages, keeping the image size smaller.
# --upgrade pip: Ensure you have the latest pip.
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code into the container at /app
COPY . .
# Make port 8000 available to the world outside this container
# Hugging Face Spaces typically expect the app on port 7860, but FastAPI defaults to 8000.
# We'll run on 8000 and let HF handle mapping if needed, or adjust the CMD.
# Let's use 7860 directly as it's common for HF.
EXPOSE 7860
# Define environment variables (optional, can be set in Hugging Face secrets)
# ENV GOOGLE_API_KEY="your_key_here" # It's better to use HF Secrets
# ENV PEXELS_API_KEY="your_key_here" # It's better to use HF Secrets
# Run main.py when the container launches
# Use 0.0.0.0 to make it accessible from outside the container.
# Use port 7860 as often expected by Hugging Face Spaces.
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]