Spaces:
Sleeping
Sleeping
# Use a Python base image suitable for Streamlit and Flask | |
FROM python:3.9-slim | |
# Set the working directory inside the container | |
WORKDIR /app | |
# Copy the requirements file and install Python dependencies | |
# This leverages Docker's build cache. | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy all your application code into the container | |
# This includes main.py, streamlit_app.py, routers/, utils/, data/, etc. | |
COPY . . | |
# Ensure the 'data' directory exists inside the container, as your Flask app expects it. | |
RUN mkdir -p data | |
# Expose the port Streamlit will listen on. | |
# Hugging Face Spaces automatically exposes port 7860 for Streamlit apps. | |
EXPOSE 7860 | |
# Command to run on container startup | |
# This command starts the Flask backend in the background and then runs the Streamlit frontend. | |
# Streamlit will then interact with your Flask application on localhost:5000. | |
CMD ["sh", "-c", "python main.py & streamlit run streamlit_app.py --server.port=7860 --server.address=0.0.0.0"] |