style-transfer / Dockerfile
dannyroxas's picture
Update Dockerfile
e21ad63 verified
FROM python:3.9-slim
# Set environment variables to avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Istanbul
WORKDIR /app
# Install system dependencies without interactive prompts
RUN apt-get update && apt-get install -y \
git \
tzdata \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
wget \
&& ln -fs /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first (for better caching)
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create user for HuggingFace Spaces
RUN useradd -m -u 1000 user
USER user
# Expose port for Streamlit
EXPOSE 7860
# Run the application with proper streamlit command
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true"]