Fix Dockerfile: Switch from Alpine to Debian Slim for better Python package compatibility
Some checks failed
Auto Build and Push Docker Image / build (push) Failing after 12s
Some checks failed
Auto Build and Push Docker Image / build (push) Failing after 12s
Changes: - Use python:3.11-slim instead of python:3.11-alpine - Install libgl1-mesa-glx and libglib2.0-0 for rembg dependencies - Remove gcc and musl-dev (not needed in Debian) - Fixes build errors with opencv-python-headless, numba, and llvmlite - Debian provides better support for Python packages with C extensions
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -1,11 +1,15 @@
|
|||||||
FROM python:3.11-alpine
|
FROM python:3.11-slim
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
RUN apk add --no-cache gcc musl-dev ffmpeg
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
ffmpeg \
|
||||||
|
libgl1-mesa-glx \
|
||||||
|
libglib2.0-0 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Set work directory
|
# Set work directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -20,7 +24,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Create non-root user
|
# Create non-root user
|
||||||
RUN adduser -D -u 1000 appuser && chown -R appuser:appuser /app
|
RUN adduser --disabled-password --gecos '' --uid 1000 appuser && chown -R appuser:appuser /app
|
||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
|
|||||||
Reference in New Issue
Block a user