CultriX commited on
Commit
d03a152
·
verified ·
1 Parent(s): 35244e6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -38
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.10-slim
3
 
4
  ENV DEBIAN_FRONTEND=noninteractive \
5
  PYTHONDONTWRITEBYTECODE=1 \
@@ -7,8 +7,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
7
 
8
  WORKDIR /app
9
 
10
- # Base OS deps (curl, git, fonts, and shared libs wkhtmltopdf needs)
11
- # + NodeSource setup prereqs
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
  ca-certificates curl gnupg git xz-utils \
14
  fontconfig fonts-dejavu-core \
@@ -16,56 +15,38 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
16
  libx11-6 libxext6 libxrender1 libxcb1 \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
- # Install wkhtmltopdf from official .deb matching the Debian codename
20
- # (tries bookworm first; falls back to bullseye)
21
  ARG WKHTML_VER=0.12.6-1
22
- RUN set -eux; \
23
- . /etc/os-release; \
24
- arch="$(dpkg --print-architecture)"; \
25
- codename="${VERSION_CODENAME:-bookworm}"; \
26
- url="https://github.com/wkhtmltopdf/packaging/releases/download/${WKHTML_VER}/wkhtmltox_${WKHTML_VER}.${codename}_${arch}.deb"; \
27
- echo "Fetching $url"; \
28
- curl -fsSL "$url" -o /tmp/wkhtml.deb || { \
29
- codename="bullseye"; \
30
- url="https://github.com/wkhtmltopdf/packaging/releases/download/${WKHTML_VER}/wkhtmltox_${WKHTML_VER}.${codename}_${arch}.deb"; \
31
- echo "Fallback fetching $url"; \
32
- curl -fsSL "$url" -o /tmp/wkhtml.deb; \
33
- }; \
34
- apt-get update && apt-get install -y --no-install-recommends /tmp/wkhtml.deb && \
35
- rm -f /tmp/wkhtml.deb && \
36
- rm -rf /var/lib/apt/lists/*
37
 
38
- # Optional: verify install
39
  RUN wkhtmltopdf --version
40
 
41
- # Install Node.js LTS (for repomix)
42
- RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
43
- apt-get update && apt-get install -y --no-install-recommends nodejs && \
44
- rm -rf /var/lib/apt/lists/*
45
 
46
- # Install repomix globally
47
  RUN npm install -g repomix
48
 
49
- # Install Poetry
50
  RUN curl -sSL https://install.python-poetry.org | python3 -
51
  ENV PATH="/root/.local/bin:$PATH"
52
-
53
- # Keep Poetry in the system env (no venvs)
54
  RUN poetry config virtualenvs.create false
55
 
56
- # Copy dep files first to leverage Docker layer caching
57
  COPY poetry.lock pyproject.toml /app/
58
-
59
- # Install Python deps
60
  RUN poetry install --no-root --no-interaction --no-ansi
61
 
62
- # Copy the rest of your app
63
  COPY . .
64
 
65
- # HF Spaces / Gradio ports
66
  EXPOSE 7860
67
- ENV GRADIO_SERVER_NAME="0.0.0.0" \
68
- GRADIO_SERVER_PORT="7860"
69
 
70
- # Start your app
71
  CMD ["python", "app.py"]
 
1
+ # Pin to Debian 12 so wkhtmltox bookworm package exists
2
+ FROM python:3.10-bookworm
3
 
4
  ENV DEBIAN_FRONTEND=noninteractive \
5
  PYTHONDONTWRITEBYTECODE=1 \
 
7
 
8
  WORKDIR /app
9
 
10
+ # OS deps + fonts + X libs required by wkhtmltopdf
 
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
  ca-certificates curl gnupg git xz-utils \
13
  fontconfig fonts-dejavu-core \
 
15
  libx11-6 libxext6 libxrender1 libxcb1 \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Install wkhtmltopdf (bookworm build)
 
19
  ARG WKHTML_VER=0.12.6-1
20
+ RUN curl -fsSL -o /tmp/wkhtml.deb \
21
+ "https://github.com/wkhtmltopdf/packaging/releases/download/${WKHTML_VER}/wkhtmltox_${WKHTML_VER}.bookworm_amd64.deb" \
22
+ && apt-get update \
23
+ && apt-get install -y --no-install-recommends /tmp/wkhtml.deb \
24
+ && rm -f /tmp/wkhtml.deb \
25
+ && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
 
 
26
 
 
27
  RUN wkhtmltopdf --version
28
 
29
+ # Node.js LTS (for repomix)
30
+ RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
31
+ && apt-get update && apt-get install -y --no-install-recommends nodejs \
32
+ && rm -rf /var/lib/apt/lists/*
33
 
34
+ # repomix
35
  RUN npm install -g repomix
36
 
37
+ # Poetry
38
  RUN curl -sSL https://install.python-poetry.org | python3 -
39
  ENV PATH="/root/.local/bin:$PATH"
 
 
40
  RUN poetry config virtualenvs.create false
41
 
42
+ # deps first for better layer caching
43
  COPY poetry.lock pyproject.toml /app/
 
 
44
  RUN poetry install --no-root --no-interaction --no-ansi
45
 
46
+ # app
47
  COPY . .
48
 
 
49
  EXPOSE 7860
50
+ ENV GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860
 
51
 
 
52
  CMD ["python", "app.py"]