jatinmehra commited on
Commit
05795cf
·
verified ·
1 Parent(s): ece2665

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -3
Dockerfile CHANGED
@@ -1,12 +1,29 @@
1
  FROM python:3.12-slim
2
  WORKDIR /app
3
  COPY requirements.txt requirements.txt
4
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  COPY . .
6
- RUN apt-get install wkhtmltopdf
7
  ARG GEMINI_API_KEY
8
  RUN --mount=type=secret,id=GEMINI_API_KEY,mode=0444,required=true \
9
  export GROQ_API_KEY=$(cat /run/secrets/GEMINI_API_KEY) && \
10
  echo "GEMINI_API_KEY is set."
11
  ENV GEMINI_API_KEY=${GEMINI_API_KEY}
12
- CMD ["python", "main.py"]
 
 
 
 
 
1
  FROM python:3.12-slim
2
  WORKDIR /app
3
  COPY requirements.txt requirements.txt
4
+
5
+ # Create and use non-root user for pip
6
+ RUN pip install --no-cache-dir --user -r requirements.txt
7
+
8
+ # Update package lists and install wkhtmltopdf with dependencies
9
+ RUN apt-get update && \
10
+ apt-get install -y --no-install-recommends \
11
+ wkhtmltopdf \
12
+ xvfb \
13
+ xfonts-75dpi \
14
+ xfonts-base \
15
+ && apt-get clean \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
  COPY . .
19
+
20
  ARG GEMINI_API_KEY
21
  RUN --mount=type=secret,id=GEMINI_API_KEY,mode=0444,required=true \
22
  export GROQ_API_KEY=$(cat /run/secrets/GEMINI_API_KEY) && \
23
  echo "GEMINI_API_KEY is set."
24
  ENV GEMINI_API_KEY=${GEMINI_API_KEY}
25
+
26
+ # Add PATH for pip user installs
27
+ ENV PATH=/root/.local/bin:$PATH
28
+
29
+ CMD ["python", "app.py"]