MicroMicro / Dockerfile
AliSakr9997's picture
Upload 3 files
eb99bc8 verified
raw
history blame contribute delete
755 Bytes
# Use standard python image
FROM python:3.9-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Create user with ID 1000
RUN useradd -m -u 1000 user
# Set working directory
WORKDIR /app
# Copy requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Download model during build to avoid runtime permission errors
RUN pip install ultralytics && \
python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')"
# Copy app code and CHANGE OWNER to user
COPY --chown=user . .
# Switch to user
USER user
ENV PATH="/home/user/.local/bin:$PATH" \
PORT=7860
# Expose port
EXPOSE 7860
# Run Flask
CMD ["python", "app.py"]