-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
57 lines (46 loc) · 1.72 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
48
49
50
51
52
53
54
55
56
57
ARG PYTHON_VERSION="3.11"
#####################################################################
#####################################################################
##
## Fat build image
##
FROM python:${PYTHON_VERSION} AS build
ARG POETRY_VERSION="1.6.1"
ENV POETRY_VIRTUALENVS_CREATE=false
RUN --mount=type=cache,target=/root/.cache \
pip install poetry=="${POETRY_VERSION}"
WORKDIR /covid-19-puerto-rico
ENV VIRTUAL_ENV="/covid-19-puerto-rico/venv"
RUN python3 -m venv "${VIRTUAL_ENV}" \
&& rm "${VIRTUAL_ENV}"/bin/[Aa]ctivate*
ENV PATH="${VIRTUAL_ENV}/bin":$PATH
COPY --link pyproject.toml poetry.lock ./
RUN --mount=type=cache,target=/root/.cache \
poetry export \
--without-hashes \
-f requirements.txt >requirements.txt \
&& pip install -r requirements.txt
COPY --link src src
RUN --mount=type=cache,target=/root/.cache \
poetry build \
&& pip install dist/covid_19_puerto_rico-*.whl \
&& pip uninstall --yes wheel setuptools pip
#####################################################################
#####################################################################
##
## Slim app image
##
FROM python:${PYTHON_VERSION}-slim AS app
RUN pip uninstall --yes wheel setuptools pip
# The rclone packaged with the OS distribution is always hopelessly out
# of date, better to get it from the official rclone Docker images.
# See: https://github.com/rclone/rclone/issues/6060
COPY --link --from=rclone/rclone:1.61.1 \
/usr/local/bin/rclone \
/usr/local/bin/rclone
WORKDIR /covid-19-puerto-rico
ENV VIRTUAL_ENV="/covid-19-puerto-rico/venv"
COPY --link --from=build "${VIRTUAL_ENV}" "${VIRTUAL_ENV}"
ENV PATH="${VIRTUAL_ENV}/bin":$PATH
COPY --link config/environment.yaml environment.yaml
CMD ["covid19pr"]