File size: 1,167 Bytes
39e8044
9bd6b9e
634d3ae
 
 
3a15341
 
 
 
39e8044
3a15341
634d3ae
9bd6b9e
 
634d3ae
 
 
 
 
39e8044
634d3ae
 
39e8044
542acd6
634d3ae
3fcba8c
39e8044
542acd6
d82f080
542acd6
9d1a90e
 
030a144
3fcba8c
39e8044
 
 
 
 
1f1339c
 
 
39e8044
634d3ae
3fcba8c
 
634d3ae
9bd6b9e
39e8044
634d3ae
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Stage 1: Builder
FROM python:3.12 AS builder

WORKDIR /app

RUN pip install --upgrade pip setuptools wheel

RUN pip install cmake

# Install system build dependencies
RUN apt-get clean && apt-get -y update && apt-get install -y build-essential cmake libopenblas-dev liblapack-dev libopenblas-dev liblapack-dev

ENV CMAKE_BUILD_PARALLEL_LEVEL=4

RUN python -m venv venv
ENV VIRTUAL_ENV=/app/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

# Stage 2: Runner
FROM python:3.12-slim AS runner

WORKDIR /app

# Install runtime dependency: libopenblas.so.0 is provided by libopenblas-base.
RUN apt-get update && apt-get install -y build-essential cmake libopenblas-dev liblapack-dev libopenblas-dev liblapack-dev

# Create the "model" directory with appropriate permissions
RUN mkdir -p /app/model && chmod -R 777 /app/model

COPY --from=builder /app/venv venv

COPY app.py .
COPY models.py .
COPY test_functions.py .

COPY examples/ /app/examples/
RUN chmod -R 777 /app/examples/

COPY assets/ assets/

ENV VIRTUAL_ENV=/app/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

EXPOSE 7000

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