Spaces:
Sleeping
Sleeping
File size: 1,120 Bytes
429e40f b874ccf 33262f5 66102ec d60be34 33262f5 12a9ca6 33262f5 66102ec 12a9ca6 33262f5 33d4e83 33262f5 33d4e83 33262f5 66102ec d60be34 33262f5 b874ccf 33262f5 33d4e83 33262f5 b874ccf 12a9ca6 33262f5 66102ec b874ccf 33262f5 a5fd7c2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Create a non-root user and home directory
RUN useradd -m -s /bin/bash streamlit_user
# Set working directory
WORKDIR /home/streamlit_user/app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
# Create model weights directory and assign ownership
RUN mkdir -p /home/streamlit_user/step1x_weights && \
chown -R streamlit_user:streamlit_user /home/streamlit_user
# Copy requirements and install Python dependencies
COPY requirements.txt ./requirements.txt
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy app source code
COPY src/ ./src/
# Change user to non-root
USER streamlit_user
# Expose Streamlit port
EXPOSE 8501
# Environment settings for Streamlit
ENV STREAMLIT_SERVER_HEADLESS=true
# Run the app
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|