File size: 914 Bytes
e52a7fb 1c736cd e52a7fb 1c736cd e52a7fb 1c736cd e52a7fb 1c736cd e52a7fb 1c736cd e52a7fb 1c736cd e52a7fb 1c736cd e52a7fb 1c736cd | 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 | FROM ultralytics/ultralytics
# Create a non-root user and group with specific IDs
RUN useradd -m -u 1000 user
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libgtk2.0-dev \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=
# Set the working directory
WORKDIR /app
# Copy the application code and change ownership to the 'user'
COPY --chown=user:user . /app
# Install required Python packages
RUN pip install gradio
# Create necessary directories and set ownership to 'user'
RUN mkdir -p /app/videos /app/results && chown -R user:user /app
# Switch to the 'user' account
USER user
EXPOSE 7860
# Environment variables
ENV PYTHONUNBUFFERED=1 \
GRADIO_ALLOW_FLAGGING=never \
GRADIO_NUM_PORTS=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
SYSTEM=spaces
# Command to run the application
CMD ["python", "app.py"]
|