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 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install dependencies into a local directory
|
||||
# Install dependencies system-wide
|
||||
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 ---
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only the installed packages from builder
|
||||
COPY --from=builder /root/.local /root/.local
|
||||
# Update PATH to include the user-installed packages
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
# Copy system-wide installed packages from builder
|
||||
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
|
||||
# Ensure /usr/local/bin (where pip installs executables by default) is in 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 connector-superoffice/worker.py .
|
||||
@@ -32,5 +34,5 @@ COPY connector-superoffice/superoffice_client.py .
|
||||
# Expose port for Webhook
|
||||
EXPOSE 8000
|
||||
|
||||
# Start both worker and webhook directly within the CMD
|
||||
CMD ["/bin/bash", "-c", "python3 worker.py & uvicorn webhook_app:app --host 0.0.0.0 --port 8000"]
|
||||
# Start both worker and webhook directly within the CMD, using absolute path for uvicorn
|
||||
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