Fix su-exec to gosu for Debian

This commit is contained in:
Atharv1705
2026-10-03 14:11:30 +05:30
parent 34a2cc0098
commit 5faff3ebbc
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -8,12 +8,12 @@ WORKDIR /app
# System deps: Tesseract OCR (Stage 2 of extraction pipeline -- CPU-only, no GPU) # System deps: Tesseract OCR (Stage 2 of extraction pipeline -- CPU-only, no GPU)
# eng: English, hin: Hindi -- for bilingual Indian documents (Aadhaar, PAN, etc.) # eng: English, hin: Hindi -- for bilingual Indian documents (Aadhaar, PAN, etc.)
# su-exec: lightweight tool to drop privileges in the entrypoint script # gosu: lightweight tool to drop privileges in the entrypoint script
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr \ tesseract-ocr \
tesseract-ocr-eng \ tesseract-ocr-eng \
tesseract-ocr-hin \ tesseract-ocr-hin \
su-exec \ gosu \
libgl1 \ libgl1 \
curl \ curl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
+3 -3
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# entrypoint.sh -- fix volume ownership then drop to appuser # entrypoint.sh -- fix volume ownership then drop to appuser
# Runs as root (before USER appuser in Dockerfile) so it can chown. # Runs as root (before USER appuser in Dockerfile) so it can chown.
# The CMD is then exec'd as appuser via gosu/su-exec. # The CMD is then exec'd as appuser via gosu/gosu.
set -e set -e
# Fix ownership of bind-mounted volumes that may have been created by root. # Fix ownership of bind-mounted volumes that may have been created by root.
@@ -9,8 +9,8 @@ chown -R appuser:appuser /app/uploads /app/services/api/chroma_db 2>/dev/null ||
# Run migrations # Run migrations
echo "[entrypoint] Running DB migrations..." echo "[entrypoint] Running DB migrations..."
su-exec appuser python /app/services/api/migrate.py gosu appuser python /app/services/api/migrate.py
# Hand off to the real command (uvicorn) as appuser # Hand off to the real command (uvicorn) as appuser
echo "[entrypoint] Starting app as appuser..." echo "[entrypoint] Starting app as appuser..."
exec su-exec appuser "$@" exec gosu appuser "$@"