File size: 683 Bytes
a740d23
 
2df1810
5b63bfa
a740d23
11f2c82
 
 
a740d23
 
 
 
 
 
 
 
 
 
 
 
2df1810
 
 
11f2c82
2df1810
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Stage 1: Builder
FROM python:3.8-bullseye as builder

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential cmake git curl wget \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --user --upgrade pip setuptools wheel && \
    pip install --user torch==2.2.1 --index-url https://download.pytorch.org/whl/cpu

# Stage 2: Runtime
FROM python:3.8-slim

COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
    && find /root/.local -type d -name tests -exec rm -rf {} +

WORKDIR /app
COPY . /app

CMD ["python", "train.py"]