docker update
Browse files- Dockerfile +4 -9
- supervisord.conf +0 -8
Dockerfile
CHANGED
@@ -20,8 +20,7 @@ RUN apt-get update && \
|
|
20 |
build-essential \
|
21 |
&& rm -rf /var/lib/apt/lists/*
|
22 |
|
23 |
-
|
24 |
-
RUN apt-get update && apt-get install -y supervisor && rm -rf /var/lib/apt/lists/*
|
25 |
|
26 |
# Create non-root user to avoid git permission issues
|
27 |
RUN useradd -m appuser && chown -R appuser /app
|
@@ -37,7 +36,6 @@ RUN git config --global --add safe.directory /app && \
|
|
37 |
git config --global user.email "[email protected]" && \
|
38 |
git config --global user.name "peace2024"
|
39 |
|
40 |
-
# Switch back to root to install dependencies
|
41 |
USER root
|
42 |
|
43 |
# Copy requirements first to leverage Docker layer caching
|
@@ -50,21 +48,18 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
|
50 |
# Copy the entire app source code
|
51 |
COPY . .
|
52 |
|
53 |
-
# Copy supervisord config
|
54 |
-
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
55 |
-
|
56 |
# Create necessary directories
|
57 |
RUN mkdir -p vector_store logs
|
58 |
|
59 |
# Expose port 7860 (used by Hugging Face Spaces)
|
60 |
EXPOSE 7860
|
61 |
|
62 |
-
# Install PyTorch
|
63 |
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
64 |
|
65 |
# Health check
|
66 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
67 |
CMD curl -f http://localhost:7860/docs || exit 1
|
68 |
|
69 |
-
# Run supervisord
|
70 |
-
CMD ["
|
|
|
20 |
build-essential \
|
21 |
&& rm -rf /var/lib/apt/lists/*
|
22 |
|
23 |
+
ENV PORT=7860
|
|
|
24 |
|
25 |
# Create non-root user to avoid git permission issues
|
26 |
RUN useradd -m appuser && chown -R appuser /app
|
|
|
36 |
git config --global user.email "[email protected]" && \
|
37 |
git config --global user.name "peace2024"
|
38 |
|
|
|
39 |
USER root
|
40 |
|
41 |
# Copy requirements first to leverage Docker layer caching
|
|
|
48 |
# Copy the entire app source code
|
49 |
COPY . .
|
50 |
|
|
|
|
|
|
|
51 |
# Create necessary directories
|
52 |
RUN mkdir -p vector_store logs
|
53 |
|
54 |
# Expose port 7860 (used by Hugging Face Spaces)
|
55 |
EXPOSE 7860
|
56 |
|
57 |
+
# Install PyTorch CPU wheels (Spaces default)
|
58 |
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
59 |
|
60 |
# Health check
|
61 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
62 |
CMD curl -f http://localhost:7860/docs || exit 1
|
63 |
|
64 |
+
# Run uvicorn directly (no supervisord)
|
65 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
|
supervisord.conf
CHANGED
@@ -12,11 +12,3 @@ stderr_logfile=/dev/stderr
|
|
12 |
stderr_logfile_maxbytes=0
|
13 |
environment=PYTHONUNBUFFERED=1,PYTHONDONTWRITEBYTECODE=1
|
14 |
|
15 |
-
[program:worker]
|
16 |
-
command=python worker/daemon.py
|
17 |
-
directory=/app
|
18 |
-
stdout_logfile=/dev/stdout
|
19 |
-
stdout_logfile_maxbytes=0
|
20 |
-
stderr_logfile=/dev/stderr
|
21 |
-
stderr_logfile_maxbytes=0
|
22 |
-
environment=PYTHONUNBUFFERED=1,PYTHONDONTWRITEBYTECODE=1
|
|
|
12 |
stderr_logfile_maxbytes=0
|
13 |
environment=PYTHONUNBUFFERED=1,PYTHONDONTWRITEBYTECODE=1
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|