tesalonikahtp commited on
Commit
af4d3c9
·
1 Parent(s): 646aa03

fix dockersize

Browse files
Files changed (3) hide show
  1. .dockerignore +8 -0
  2. Dockerfile +16 -9
  3. requirements.txt +0 -2
.dockerignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ __pycache__
2
+ *.pyc
3
+ .git
4
+ .env
5
+ venv
6
+ .venv
7
+ node_modules
8
+ .cache
Dockerfile CHANGED
@@ -1,24 +1,31 @@
1
- # Base image
2
- FROM python:3.13-slim AS base
3
 
4
  WORKDIR /home/user/app
5
 
 
 
 
 
 
 
 
 
6
  COPY requirements.txt .
 
7
 
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- wget gnupg ca-certificates && \
10
- pip install --upgrade pip && \
11
- pip install --no-cache-dir -r requirements.txt && \
12
- pip install playwright && \
13
  mkdir -p /home/user/.cache/ms-playwright && \
14
- PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright playwright install --with-deps && \
15
- apt-get clean && rm -rf /var/lib/apt/lists/*
16
 
17
  COPY . .
 
18
  RUN chmod -R 755 /home/user
19
 
20
  EXPOSE 7860
21
  ENV PORT=7860
22
  ENV PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright
23
 
 
 
24
  CMD ["python", "-m", "hypercorn", "server:app", "-b", "0.0.0.0:7860", "--access-log", "-", "--error-log", "-", "--log-level", "info"]
 
1
+ FROM python:3.11-slim
 
2
 
3
  WORKDIR /home/user/app
4
 
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ wget gnupg ca-certificates \
7
+ libgl1-mesa-glx \
8
+ libglib2.0-0 \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
12
+
13
  COPY requirements.txt .
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ RUN pip install --no-cache-dir playwright && \
 
 
 
 
17
  mkdir -p /home/user/.cache/ms-playwright && \
18
+ PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright playwright install chromium --with-deps && \
19
+ rm -rf /var/lib/apt/lists/*
20
 
21
  COPY . .
22
+
23
  RUN chmod -R 755 /home/user
24
 
25
  EXPOSE 7860
26
  ENV PORT=7860
27
  ENV PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright
28
 
29
+ ENV HF_HOME=/home/user/.cache/huggingface
30
+
31
  CMD ["python", "-m", "hypercorn", "server:app", "-b", "0.0.0.0:7860", "--access-log", "-", "--error-log", "-", "--log-level", "info"]
requirements.txt CHANGED
@@ -22,8 +22,6 @@ boto3
22
  numpy
23
  opencv-python-headless
24
  pillow
25
- torch
26
- torchvision
27
  transformers
28
  huggingface_hub
29
  accelerate
 
22
  numpy
23
  opencv-python-headless
24
  pillow
 
 
25
  transformers
26
  huggingface_hub
27
  accelerate