pathii commited on
Commit
a740d23
·
verified ·
1 Parent(s): af8234c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -39
Dockerfile CHANGED
@@ -1,49 +1,25 @@
1
- FROM python:3.8-bullseye # Using full Debian image for better compatibility
 
2
 
3
- # Set up environment
4
- ENV PYTHONUNBUFFERED=1 \
5
- DEBIAN_FRONTEND=noninteractive \
6
- PIP_NO_CACHE_DIR=1 \
7
- PIP_DISABLE_PIP_VERSION_CHECK=1
8
-
9
- # Install system dependencies - expanded set
10
  RUN apt-get update && apt-get install -y --no-install-recommends \
11
- build-essential \
12
- cmake \
13
- git \
14
- curl \
15
- wget \
16
- libopenblas-dev \
17
- libssl-dev \
18
- zlib1g-dev \
19
- libbz2-dev \
20
- libreadline-dev \
21
- libsqlite3-dev \
22
- llvm \
23
- libncurses5-dev \
24
- libncursesw5-dev \
25
- xz-utils \
26
- tk-dev \
27
- libffi-dev \
28
- liblzma-dev \
29
  && rm -rf /var/lib/apt/lists/*
30
 
31
- # Install Python packages with precise order and fallbacks
32
  COPY requirements.txt .
33
- RUN pip install --upgrade pip setuptools wheel && \
34
- pip install torch==2.2.1 --index-url https://download.pytorch.org/whl/cpu && \
35
- pip install ninja==1.11.1 && \
36
- pip install transformers==4.38.2 && \
37
- pip install accelerate==0.27.2 && \
38
- pip install datasets==2.18.0 && \
39
- pip install huggingface_hub==0.20.3 && \
40
- { pip install deepspeed==0.13.1 || pip install deepspeed==0.13.1 --no-deps; } && \
41
- pip install unsloth==0.2.0 && \
42
- { pip install vllm==0.3.0 || pip install vllm==0.3.0 --no-deps; } && \
43
- pip install fastapi==0.109.1 uvicorn==0.27.0
 
44
 
45
  WORKDIR /app
46
  COPY . /app
47
- RUN mkdir -p /app/checkpoints /app/logs
48
 
49
  CMD ["python", "train.py"]
 
1
+ # Stage 1: Builder
2
+ FROM python:3.8-bullseye as builder
3
 
 
 
 
 
 
 
 
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ build-essential cmake git curl wget \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  && rm -rf /var/lib/apt/lists/*
7
 
 
8
  COPY requirements.txt .
9
+ RUN pip install --user --upgrade pip setuptools wheel && \
10
+ pip install --user torch==2.2.1 --index-url https://download.pytorch.org/whl/cpu
11
+
12
+ # Stage 2: Runtime
13
+ FROM python:3.8-slim
14
+
15
+ COPY --from=builder /root/.local /root/.local
16
+ ENV PATH=/root/.local/bin:$PATH
17
+
18
+ COPY requirements.txt .
19
+ RUN pip install --no-cache-dir -r requirements.txt \
20
+ && find /root/.local -type d -name tests -exec rm -rf {} +
21
 
22
  WORKDIR /app
23
  COPY . /app
 
24
 
25
  CMD ["python", "train.py"]