pranit144 commited on
Commit
b52d67a
·
verified ·
1 Parent(s): a099c6f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -30
Dockerfile CHANGED
@@ -1,48 +1,32 @@
1
- # Use the official slim Python 3.9 image
2
  FROM python:3.9-slim
3
 
4
- # --------------------
5
- # Environment settings
6
- # --------------------
7
- # Don't write .pyc files and buffer stdout/stderr
8
  ENV PYTHONDONTWRITEBYTECODE=1
9
  ENV PYTHONUNBUFFERED=1
10
 
11
- # Where uploaded PDFs will go
12
- ENV UPLOAD_DIR=/mnt/data/uploads
13
 
14
- # --------------------
15
- # Working directory
16
- # --------------------
17
  WORKDIR /app
18
 
19
- # --------------------
20
- # System dependencies
21
- # --------------------
22
  RUN apt-get update \
23
- && apt-get install -y --no-install-recommends \
24
- build-essential \
25
- && rm -rf /var/lib/apt/lists/*
26
 
27
- # --------------------
28
- # Python dependencies
29
- # --------------------
30
  COPY requirements.txt .
31
  RUN pip install --no-cache-dir -r requirements.txt
32
 
33
- # --------------------
34
- # Application code
35
- # --------------------
36
  COPY . .
37
 
38
- # --------------------
39
- # Create writable dirs
40
- # --------------------
41
- RUN mkdir -p "${UPLOAD_DIR}" static/images \
42
- && chmod 777 "${UPLOAD_DIR}" static/images
43
 
44
- # --------------------
45
- # Expose & run
46
- # --------------------
47
  EXPOSE 7860
48
  CMD ["gunicorn", "--workers", "4", "--bind", "0.0.0.0:7860", "app:app"]
 
1
+ # 1. Base image
2
  FROM python:3.9-slim
3
 
4
+ # 2. Prevent __pycache__, buffer logs
 
 
 
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
 
8
+ # 3. Define where uploads go
9
+ ENV UPLOAD_DIR=/mnt/data
10
 
11
+ # 4. Set working dir
 
 
12
  WORKDIR /app
13
 
14
+ # 5. System deps (only if you need to compile wheels)
 
 
15
  RUN apt-get update \
16
+ && apt-get install -y --no-install-recommends build-essential \
17
+ && rm -rf /var/lib/apt/lists/*
 
18
 
19
+ # 6. Python deps
 
 
20
  COPY requirements.txt .
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # 7. Copy app code
 
 
24
  COPY . .
25
 
26
+ # 8. Pre-create writable dirs
27
+ RUN mkdir -p "${UPLOAD_DIR}/uploads" static/images \
28
+ && chmod -R 777 "${UPLOAD_DIR}/uploads" static/images
 
 
29
 
30
+ # 9. Expose & run
 
 
31
  EXPOSE 7860
32
  CMD ["gunicorn", "--workers", "4", "--bind", "0.0.0.0:7860", "app:app"]