CingenAI / Dockerfile
mgbam's picture
Update Dockerfile
28c3258 verified
raw
history blame
1.62 kB
FROM python:3.10-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Still good practice for preventing interactive prompts during apt-get install
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies (ffmpeg, fontconfig for managing copied fonts)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
libsm6 \
libxext6 \
fontconfig && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create directory for custom fonts and copy your font file(s)
# Make sure 'assets/fonts/arial.ttf' (or your chosen font) exists in your repository
RUN mkdir -p /usr/local/share/fonts/truetype/mycustomfonts
COPY assets/fonts/arial.ttf /usr/local/share/fonts/truetype/mycustomfonts/arial.ttf
# If you have other fonts, COPY them here as well:
# COPY assets/fonts/anotherfont.ttf /usr/local/share/fonts/truetype/mycustomfonts/anotherfont.ttf
# Rebuild font cache to make newly installed fonts available
RUN fc-cache -f -s -v # -s for system-wide, -v for verbose
# Create a non-root user and group
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
WORKDIR /home/appuser/app
COPY --chown=appuser:appgroup requirements.txt ./
USER appuser
RUN python -m pip install --no-cache-dir --upgrade pip
RUN python -m pip install --no-cache-dir -r requirements.txt
COPY --chown=appuser:appgroup . .
EXPOSE 8501
CMD ["streamlit", "run", "app.py", "--server.headless=true", "--server.port=8501", "--server.fileWatcherType=none"]