-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
41 lines (33 loc) · 1.19 KB
/
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
FROM python:3.9-slim AS base
FROM base AS builder
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
PATH="$PATH:/runtime/bin" \
PYTHONPATH="$PYTHONPATH:/runtime/lib/python3.9/site-packages" \
# Versions:
POETRY_VERSION=1.2.0a2
# System deps:
RUN apt-get update && apt-get install -y build-essential unzip wget python-dev
RUN pip install "poetry==$POETRY_VERSION"
RUN python3 -m venv /runtime
# Generate requirements and install dependencies.
COPY pyproject.toml ./
RUN /runtime/bin/pip3 install --upgrade pip && \
poetry lock --no-plugins && \
poetry export --no-plugins --without-hashes -f requirements.txt | /runtime/bin/pip3 install -r /dev/stdin
COPY . .
RUN poetry plugin add poetry-version-plugin && \
poetry build && /runtime/bin/pip install dist/*.whl
FROM base as runtime
RUN apt-get update && apt install -y libmagic1 && apt-get clean
COPY --from=builder /runtime /runtime
# Expose and entrypoint
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]