36 lines
1.0 KiB
Docker
36 lines
1.0 KiB
Docker
|
|
# 1. Basis-Image
|
|
FROM python:3.11-slim
|
|
|
|
# Install su-exec, a lightweight tool for dropping privileges
|
|
RUN apt-get update && apt-get install -y --no-install-recommends gosu && rm -rf /var/lib/apt/lists/*
|
|
|
|
# 2. Arbeitsverzeichnis im Container setzen
|
|
WORKDIR /app
|
|
|
|
# 3. Abhängigkeiten installieren
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 4. Anwendungs-Code kopieren
|
|
COPY . .
|
|
|
|
# Create the data directory that will be used by the volume
|
|
# The entrypoint script will set the correct permissions on this
|
|
RUN mkdir -p /app/data
|
|
|
|
# Copy and set permissions for the entrypoint script
|
|
COPY entrypoint.sh .
|
|
RUN chmod +x entrypoint.sh
|
|
|
|
# 5. Port freigeben, auf dem die App läuft
|
|
EXPOSE 8000
|
|
|
|
# 6. Umgebungsvariable für die Gotify-URL (kann beim Start überschrieben werden)
|
|
ENV GOTIFY_URL=""
|
|
|
|
# 7. Entrypoint und Befehl zum Starten der Anwendung
|
|
# The entrypoint script will handle user permissions and then run the CMD
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|