MaroofTechSorcerer's picture
Update Dockerfile
51c2389 verified
raw
history blame
833 Bytes
FROM python:3.10-slim
# Set environment variables for consistent builds
ENV PYTHONUNBUFFERED=1
ENV VENV_PATH=/opt/venv
# Install system dependencies from apt.txt
COPY apt.txt .
RUN apt-get update && \
xargs -a apt.txt apt-get install -y && \
rm -rf /var/lib/apt/lists/*
# Create and activate virtual environment
RUN python -m venv $VENV_PATH
ENV PATH="$VENV_PATH/bin:$PATH"
# Upgrade pip in virtual environment
RUN pip install --upgrade pip
# Install Python dependencies in virtual environment
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Set working directory
WORKDIR /app
# Copy app code
COPY app.py .
# Expose port for Hugging Face Spaces
EXPOSE 7860
# Run Streamlit app using virtual environment
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]