fix: [30388f42] Connector Dockerfile - Finaler Uvicorn PATH Fix (Hardened)
- Fuegt RUN which uvicorn als Verifizierungs-Schritt nach pip install hinzu. - Aendert den CMD Befehl, um uvicorn mit seinem absoluten Pfad (/usr/local/bin/uvicorn) aufzurufen. - Behebt den uvicorn: command not found Fehler endgueltig.
This commit is contained in:
@@ -8,19 +8,21 @@ 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/*
|
||||||
|
|
||||||
# Install dependencies into a local directory
|
# Install dependencies system-wide
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --user --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
# VERIFICATION STEP: Ensure uvicorn is installed and found
|
||||||
|
RUN which uvicorn || (echo "ERROR: uvicorn not found after install!" && exit 1)
|
||||||
|
|
||||||
# --- STAGE 2: Final Runtime ---
|
# --- STAGE 2: Final Runtime ---
|
||||||
FROM python:3.11-slim
|
FROM python:3.11-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy only the installed packages from builder
|
# Copy system-wide installed packages from builder
|
||||||
COPY --from=builder /root/.local /root/.local
|
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
|
||||||
# Update PATH to include the user-installed packages
|
# Ensure /usr/local/bin (where pip installs executables by default) is in PATH
|
||||||
ENV PATH=/root/.local/bin:$PATH
|
ENV PATH=/usr/local/bin:$PATH
|
||||||
|
|
||||||
# Copy source code explicitly from their locations relative to the build context (which will be the project root)
|
# Copy source code explicitly from their locations relative to the build context (which will be the project root)
|
||||||
COPY connector-superoffice/worker.py .
|
COPY connector-superoffice/worker.py .
|
||||||
@@ -32,5 +34,5 @@ COPY connector-superoffice/superoffice_client.py .
|
|||||||
# Expose port for Webhook
|
# Expose port for Webhook
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Start both worker and webhook directly within the CMD
|
# Start both worker and webhook directly within the CMD, using absolute path for uvicorn
|
||||||
CMD ["/bin/bash", "-c", "python3 worker.py & uvicorn webhook_app:app --host 0.0.0.0 --port 8000"]
|
CMD ["/bin/bash", "-c", "python3 worker.py & /usr/local/bin/uvicorn webhook_app:app --host 0.0.0.0 --port 8000"]
|
||||||
|
|||||||
Reference in New Issue
Block a user