QueryFoxy / Dockerfile
MahekTrivedi's picture
Upload 13 files
ba3347a verified
raw
history blame contribute delete
948 Bytes
# Use a Python base image
FROM python:3.9-slim-buster
# Set the working directory in the container
WORKDIR /app
# Copy the requirements file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy all other application files into the container
COPY . .
# Initialize the database
# This command runs once when the Docker image is built
# RUN python -c "from db import init_db; init_db()"
# Expose the port that Uvicorn will listen on.
# Hugging Face Spaces typically uses port 7860 for Gradio apps,
# or 8000 for general web apps. Let's use 7860 as Gradio is present.
EXPOSE 7860
# Command to run the application using Uvicorn
# 'app:fastapi_app' means run the 'fastapi_app' object from 'app.py'
# --host 0.0.0.0 makes it accessible from outside the container
# --port uses the exposed port
CMD ["uvicorn", "app:fastapi_app", "--host", "0.0.0.0", "--port", "7860"]