All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 1m11s
Changes: - Replace libgl1-mesa-glx with libgl1 - Add libsm6, libxext6, libxrender-dev for OpenCV - Add libgomp1 for OpenMP support - Better package selection for python:3.11-slim base
40 lines
863 B
Docker
40 lines
863 B
Docker
FROM python:3.11-slim
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ffmpeg \
|
|
libgl1 \
|
|
libglib2.0-0 \
|
|
libsm6 \
|
|
libxext6 \
|
|
libxrender-dev \
|
|
libgomp1 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set work directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first for better caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy project
|
|
COPY . .
|
|
|
|
# Create non-root user
|
|
RUN adduser --disabled-password --gecos '' --uid 1000 appuser && chown -R appuser:appuser /app
|
|
USER appuser
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD python -c "import sys; sys.exit(0)"
|
|
|
|
# Run the bot
|
|
CMD ["python", "bot.py"]
|