rajkhanke commited on
Commit
4b7639b
·
verified ·
1 Parent(s): f852fac

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -7
Dockerfile CHANGED
@@ -5,13 +5,13 @@ FROM python:3.9-slim
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
 
8
- # 3. Define where uploads go (inside the app directory)
9
  ENV UPLOAD_DIR=/app/uploads
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/*
@@ -23,10 +23,14 @@ RUN pip install --no-cache-dir -r requirements.txt
23
  # 7. Copy app code
24
  COPY . .
25
 
26
- # 8. Pre-create writable dirs
27
- RUN mkdir -p "${UPLOAD_DIR}/pdfs" static/images \
28
- && chmod -R 777 "${UPLOAD_DIR}" static/images
 
 
 
 
29
 
30
- # 9. Expose & run
31
  EXPOSE 7860
32
- CMD ["gunicorn", "--workers", "4", "--bind", "0.0.0.0:7860", "app:app"]
 
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
 
8
+ # 3. Define where uploads go
9
  ENV UPLOAD_DIR=/app/uploads
10
 
11
  # 4. Set working dir
12
  WORKDIR /app
13
 
14
+ # 5. System deps
15
  RUN apt-get update \
16
  && apt-get install -y --no-install-recommends build-essential \
17
  && rm -rf /var/lib/apt/lists/*
 
23
  # 7. Copy app code
24
  COPY . .
25
 
26
+ # 8. Create a simple entrypoint script
27
+ RUN printf '#!/bin/sh\n\
28
+ mkdir -p "${UPLOAD_DIR}/pdfs"\n\
29
+ chmod -R 777 "${UPLOAD_DIR}" static/images\n\
30
+ exec gunicorn --workers 4 --bind 0.0.0.0:7860 app:app\n' \
31
+ > /entrypoint.sh \
32
+ && chmod +x /entrypoint.sh
33
 
34
+ # 9. Expose port and use the entrypoint
35
  EXPOSE 7860
36
+ ENTRYPOINT ["/entrypoint.sh"]