Population_api / Dockerfile
Chittrarasu's picture
code changes
6d255dd
raw
history blame contribute delete
896 Bytes
# Use Python 3.11 as the base image
FROM python:3.11
# Set the working directory inside the container
WORKDIR /app
# Copy all project files into the container
COPY . /app
# Install dependencies
RUN pip install --upgrade pip
RUN pip install -r requirement.txt
# Expose the required port (Hugging Face Spaces uses 7860)
EXPOSE 7860
# Ensure logs directory exists
RUN mkdir -p /app/logs && chmod -R 777 /app/logs
# Install tmux to run multiple processes
RUN apt-get update && apt-get install -y tmux
# Start FastAPI & Streamlit together using tmux
# CMD ["sh", "-c", "tmux new-session -d -s fastapi 'uvicorn backend.main:app --host 0.0.0.0 --port 7860' && streamlit run Frontend/app.py --server.port 7860 --server.address 0.0.0.0"]
CMD ["sh", "-c", "uvicorn backend.main:app --host 0.0.0.0 --port 8000 & sleep 5 && streamlit run Frontend/app.py --server.port 7860 --server.address 0.0.0.0"]