mirror of
https://github.com/R0m1k3/TodoFlow.git
synced 2026-10-11 17:28:17 +02:00
Fix permission denied error on uvicorn using /opt/venv instead of /root/.local
This commit is contained in:
1 parent
711b53c9c6
commit
f9e9a0cc16
1 file changed
+9
-4
+9
-4
@@ -7,19 +7,23 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
build-essential \
|
build-essential \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Création d'un environnement virtuel propre
|
||||||
|
RUN python -m venv /opt/venv
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir --user -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# --- Stage 2: Final Minimal Image ---
|
# --- Stage 2: Final Minimal Image ---
|
||||||
FROM python:3.11-slim AS runner
|
FROM python:3.11-slim AS runner
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copie des dépendances compilées depuis builder
|
# Copie de l'environnement virtuel depuis builder
|
||||||
COPY --from=builder /root/.local /root/.local
|
COPY --from=builder /opt/venv /opt/venv
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
ENV PATH=/root/.local/bin:$PATH
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Création d'un répertoire pour la base de données SQLite persistante
|
# Création d'un répertoire pour la base de données SQLite persistante
|
||||||
@@ -33,3 +37,4 @@ EXPOSE 8000
|
|||||||
|
|
||||||
# Lancement d'Uvicorn
|
# Lancement d'Uvicorn
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
|
||||||
Reference in new issue
Block a user