Fix Docker Runtime: Use venv path and set PATH/PYTHONPATH
Browse files- Dockerfile +6 -1
Dockerfile
CHANGED
|
@@ -40,6 +40,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 40 |
curl \
|
| 41 |
&& rm -rf /var/lib/apt/lists/*
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
# Copy virtualenv from builder
|
| 44 |
COPY --from=python-builder /build-python/venv /app/venv
|
| 45 |
|
|
@@ -66,4 +70,5 @@ EXPOSE 7860
|
|
| 66 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
|
| 67 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 68 |
|
| 69 |
-
|
|
|
|
|
|
| 40 |
curl \
|
| 41 |
&& rm -rf /var/lib/apt/lists/*
|
| 42 |
|
| 43 |
+
# Use virtualenv binaries
|
| 44 |
+
ENV PATH="/app/venv/bin:$PATH"
|
| 45 |
+
ENV PYTHONPATH="/app"
|
| 46 |
+
|
| 47 |
# Copy virtualenv from builder
|
| 48 |
COPY --from=python-builder /build-python/venv /app/venv
|
| 49 |
|
|
|
|
| 70 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
|
| 71 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 72 |
|
| 73 |
+
# Run the application using the venv's uvicorn
|
| 74 |
+
CMD ["/app/venv/bin/uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
|