Spaces:
Running
Running
File size: 1,211 Bytes
378b27b deb4e3b f38da43 378b27b deb4e3b f38da43 378b27b deb4e3b e0622a9 fedf340 77b790b deb4e3b f38da43 378b27b deb4e3b 378b27b 4c72d1f 378b27b 77b790b deb4e3b 378b27b deb4e3b 77b790b 378b27b cedbeb8 f4cd92d f2ee52a 378b27b f4cd92d 378b27b cedbeb8 f38da43 378b27b |
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 48 49 50 |
# Use the official Python image as a base image
FROM python:3.9-slim
# Set the working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
gcc \
g++ \
python3-tk \
tk-dev \
ffmpeg \
fonts-liberation \
&& rm -rf /var/lib/apt/lists/*
# Copy project files to the container
COPY . /app
# Upgrade pip
RUN pip install --upgrade pip
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV MPLCONFIGDIR=/tmp/matplotlib
# Create necessary directories and set permissions
RUN mkdir -p /.fonts /.config /app/models && \
chmod -R 777 /.fonts /.config /app/models
RUN mkdir -p /app/flagged && chmod 777 /app/flagged
RUN apt-get update && apt-get install -y curl && \
curl -L -o /tmp/frpc_linux_amd64 https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64 && \
mv /tmp/frpc_linux_amd64 /usr/local/lib/python3.9/site-packages/gradio/frpc_linux_amd64_v0.2
# Create a non-root user
RUN useradd -m appuser
USER appuser
# Run the application
CMD ["python", "app.py"]
|