afulara's picture
Update DOcker file againa
5e93660
raw
history blame contribute delete
848 Bytes
# Use Python 3.9 base
FROM python:3.9
# Install Node.js & npm (for building React)
RUN apt-get update && apt-get install -y nodejs npm
# Create a working directory
WORKDIR /app
# Copy requirements and install Python deps
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
# Copy the entire project
COPY . /app
# Build the frontend
WORKDIR /app/frontend
RUN npm install
RUN npm run build
# Move the built frontend into the backend static folder
WORKDIR /app
RUN cp -R /app/frontend/build /app/backend/static
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Set environment variables
ENV PORT 7860
ENV HOST 0.0.0.0
# Switch to the backend directory
WORKDIR /app/backend
# Run the FastAPI application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]