mirror of
https://github.com/Andre-Bzk/Rezept0r.git
synced 2026-11-15 15:43:04 +01:00
fix: Stack-Umgebungsvariablen via environment: an Container weitergeben
feat: entrypoint.sh mit gosu für automatisches chown und Privilege-Drop
This commit is contained in:
+6
-1
@@ -4,6 +4,7 @@ FROM python:3.12-slim-bookworm
|
|||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
curl \
|
curl \
|
||||||
|
gosu \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install yt-dlp (standalone binary, always up-to-date)
|
# Install yt-dlp (standalone binary, always up-to-date)
|
||||||
@@ -18,7 +19,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN mkdir -p /app/tmp
|
RUN mkdir -p /app/tmp /app/data
|
||||||
|
|
||||||
ENV APP_HOST=0.0.0.0
|
ENV APP_HOST=0.0.0.0
|
||||||
ENV APP_PORT=8000
|
ENV APP_PORT=8000
|
||||||
@@ -26,5 +27,9 @@ ENV TMP_DIR=/app/tmp
|
|||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
# Single worker to stay within Pi 3's memory budget
|
# Single worker to stay within Pi 3's memory budget
|
||||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
|
||||||
|
|||||||
@@ -7,6 +7,17 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- path: .env
|
- path: .env
|
||||||
required: false
|
required: false
|
||||||
|
environment:
|
||||||
|
- OPENAI_API_KEY
|
||||||
|
- USDA_API_KEY
|
||||||
|
- TANDOOR_BASE_URL
|
||||||
|
- TANDOOR_API_TOKEN
|
||||||
|
- TMP_DIR
|
||||||
|
- APP_HOST
|
||||||
|
- APP_PORT
|
||||||
|
- FFMPEG_LOCATION
|
||||||
|
- APP_UID
|
||||||
|
- APP_GID
|
||||||
ports:
|
ports:
|
||||||
- "88:8000"
|
- "88:8000"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
APP_UID=${APP_UID:-1000}
|
||||||
|
APP_GID=${APP_GID:-1000}
|
||||||
|
|
||||||
|
# Fix ownership of mounted volumes so the app user can write to them
|
||||||
|
chown "${APP_UID}:${APP_GID}" /app/tmp /app/data /app/data/images
|
||||||
|
|
||||||
|
# Drop from root to app user and run the actual command
|
||||||
|
exec gosu "${APP_UID}:${APP_GID}" "$@"
|
||||||
Reference in New Issue
Block a user