-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
47 lines (35 loc) · 1.47 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
42
43
44
45
46
47
# https://stackoverflow.com/questions/53835198/integrating-python-poetry-with-docker/54763270#54763270
FROM python:3.10
# --------------------------------------
# ------------- Set labels -------------
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL name="tyrannosaurus"
LABEL version="0.11.0"
LABEL vendor="dmyersturnbull"
LABEL org.opencontainers.image.title="tyrannosaurus"
LABEL org.opencontainers.image.version="0.11.0"
LABEL org.opencontainers.image.url="https://github.com/dmyersturnbull/tyrannosaurus"
LABEL org.opencontainers.image.documentation="https://github.com/dmyersturnbull/tyrannosaurus"
# --------------------------------------
# ---------- Copy and install ----------
# ENV no longer adds a layer in new Docker versions,
# so we don't need to chain these in a single line
ENV PYTHONFAULTHANDLER=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONHASHSEED=random
ENV PIP_NO_CACHE_DIR=off
ENV PIP_DISABLE_PIP_VERSION_CHECK=on
ENV PIP_DEFAULT_TIMEOUT=120
# Install system deps
RUN pip install 'poetry>=1.2,<2'
# Copy only requirements to cache them in docker layer
WORKDIR /code
COPY poetry.lock pyproject.toml /code/
# Install with poetry
# pip install would probably work, too, but we'd have to make sure it's a recent enough pip
# Don't bother creating a virtual env -- significant performance increase
RUN poetry config virtualenvs.create false
RUN poetry install --no-dev --no-interaction --no-ansi
# Copy to workdir
COPY . /code
CMD tyrannosaurus --help