-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
44 lines (31 loc) · 961 Bytes
/
Dockerfile
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
# Base Stage
FROM python:3.10-slim AS base
ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1
RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Build Stage
FROM base AS builder
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VERSION=1.8.3
RUN pip install "poetry==$POETRY_VERSION"
RUN python -m venv /venv
COPY pyproject.toml poetry.lock ./
RUN . /venv/bin/activate && poetry install --without=dev --no-root --no-interaction --no-ansi
COPY . .
RUN . /venv/bin/activate && poetry build
# Final Stage
FROM base AS final
ARG PIP_EXTRA=false
WORKDIR /app
COPY --from=builder /venv /venv
COPY --from=builder /app/dist .
RUN . /venv/bin/activate \
&& pip install *.whl \
&& if [ "$PIP_EXTRA" != "false" ] ; then pip install "$PIP_EXTRA"; fi
ENTRYPOINT ["/venv/bin/modelbench", "--help"]