File size: 1,477 Bytes
9ede49e 5afbe18 264ac69 392f2f7 5e1192b 392f2f7 ce859c4 264ac69 28c3258 73b4d32 ce859c4 392f2f7 111ba62 0f0f717 111ba62 392f2f7 5e1192b bdaeba8 392f2f7 0f0f717 392f2f7 264ac69 392f2f7 264ac69 392f2f7 0f0f717 bdaeba8 264ac69 392f2f7 264ac69 5e1192b 5afbe18 73b4d32 |
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 45 46 47 |
FROM python:3.10-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive \
PATH="/home/appuser/.local/bin:${PATH}"
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
libsm6 \
libxext6 \
fontconfig && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set up custom fonts
RUN mkdir -p /usr/local/share/fonts/truetype/mycustomfonts
COPY assets/fonts/arial.ttf /usr/local/share/fonts/truetype/mycustomfonts/arial.ttf
RUN fc-cache -f -s -v
# Create non-root user
ARG APP_USER_UID=1000
ARG APP_USER_GID=1000
RUN groupadd --gid $APP_USER_GID appgroup && \
useradd --uid $APP_USER_UID --gid appgroup --shell /bin/bash --create-home appuser
# Create and set working directory with proper permissions
RUN mkdir -p /home/appuser/app && chown appuser:appgroup /home/appuser/app
WORKDIR /home/appuser/app
# Install Python dependencies
COPY --chown=appuser:appgroup requirements.txt ./
USER appuser
RUN python -m pip install --no-cache-dir --upgrade pip && \
python -m pip install --no-cache-dir -r requirements.txt --verbose
# Create writable directory for application temp files
RUN mkdir -p temp_cinegen_media && chmod 775 temp_cinegen_media
# Copy application code
COPY --chown=appuser:appgroup . .
EXPOSE 8501
CMD ["streamlit", "run", "app.py", "--server.headless=true", "--server.port=8501", "--server.fileWatcherType=none"] |