-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (35 loc) · 1.18 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
FROM python:3.10
ENV PYTHONUNBUFFERED=1 \
# prevents python creating .pyc files
PYTHONDONTWRITEBYTECODE=1 \
\
# pip
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
\
# poetry minimal version
POETRY_VERSION=1.2.0b1 \
# make poetry create the virtual environment in the project's root
# it gets named `.venv`
POETRY_VIRTUALENVS_IN_PROJECT=true \
# do not ask any interactive question
POETRY_NO_INTERACTION=1 \
POETRY_DYNAMIC_VERSIONING_PLUGIN_VERSION=0.3.1
RUN pip install --upgrade pip \
&& pip install 'poetry>=$POETRY_VERSION'
WORKDIR /opt/app
# Install dependencies
COPY pyproject.toml poetry.lock ./
# Install the dependencies first, then add the versioning
# plugin to remove the need to mount the `.git` folder, and
# thus caching better.
RUN poetry install --without=dev --no-root \
&& poetry plugin add poetry-dynamic-versioning-plugin@${POETRY_DYNAMIC_VERSIONING_PLUGIN_VERSION}
# Install the project
COPY README.md ./
COPY src ./src
RUN --mount=source=.git,target=.git,type=bind \
poetry dynamic-versioning \
&& poetry install --without=dev
CMD ["poetry", "run", "linkhub_exporter"]