Rulga commited on
Commit
9ee7abb
·
1 Parent(s): 9ab4c95

Enhance Dockerfile with verbose output for system dependency installation and improved logging during setup

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -13
Dockerfile CHANGED
@@ -2,21 +2,30 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
6
- RUN apt-get update && apt-get install -y \
 
 
7
  build-essential \
8
- && rm -rf /var/lib/apt/lists/*
 
 
 
9
 
10
  # Create directories with secure permissions
11
- RUN mkdir -p cache/huggingface vector_store chat_history \
12
- && chown -R 1000:1000 . \
13
- && chmod -R 755 .
 
 
14
 
15
  # Copy requirements first for better caching
16
  COPY requirements.txt .
17
- RUN pip install --no-cache-dir -r requirements.txt
 
 
18
 
19
- # Copy only necessary files
20
  COPY app.py .
21
  COPY .env .
22
  COPY index.html .
@@ -28,9 +37,11 @@ ENV XDG_CACHE_HOME=/app/cache
28
  ENV PORT=8000
29
 
30
  # Set permissions
31
- RUN chown -R 1000:1000 /app \
32
- && find /app -type d -exec chmod 755 {} \; \
33
- && find /app -type f -exec chmod 644 {} \;
 
 
34
 
35
  # Run as non-privileged user
36
  USER 1000
@@ -41,5 +52,5 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
41
 
42
  EXPOSE 8000
43
 
44
- # Use a startup script
45
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--timeout-keep-alive", "120"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies with verbose output
6
+ RUN set -x && \
7
+ apt-get update && \
8
+ apt-get install -y \
9
  build-essential \
10
+ curl \
11
+ git \
12
+ && rm -rf /var/lib/apt/lists/* \
13
+ && echo "System dependencies installed successfully"
14
 
15
  # Create directories with secure permissions
16
+ RUN set -x && \
17
+ mkdir -p cache/huggingface vector_store chat_history && \
18
+ chown -R 1000:1000 . && \
19
+ chmod -R 755 . && \
20
+ echo "Directories created successfully"
21
 
22
  # Copy requirements first for better caching
23
  COPY requirements.txt .
24
+ RUN set -x && \
25
+ pip install --no-cache-dir -r requirements.txt && \
26
+ echo "Python dependencies installed successfully"
27
 
28
+ # Copy application files
29
  COPY app.py .
30
  COPY .env .
31
  COPY index.html .
 
37
  ENV PORT=8000
38
 
39
  # Set permissions
40
+ RUN set -x && \
41
+ chown -R 1000:1000 /app && \
42
+ find /app -type d -exec chmod 755 {} \; && \
43
+ find /app -type f -exec chmod 644 {} \; && \
44
+ echo "Permissions set successfully"
45
 
46
  # Run as non-privileged user
47
  USER 1000
 
52
 
53
  EXPOSE 8000
54
 
55
+ # Use a startup script with debug output
56
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--log-level", "debug"]