Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (36 loc) · 1.44 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (36 loc) · 1.44 KB
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
FROM python:3.12-bookworm as python-base
LABEL maintainer="TACC COA CMD <[email protected]>"
ARG DEBIAN_FRONTEND=noninteractive
# https://python-poetry.org/docs/configuration/#using-environment-variables
ENV POETRY_VERSION=2.3.2 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
PYSETUP_PATH="/opt/pysetup" \
VENV_PATH="/opt/pysetup/.venv"
# prepend venv and poetry to path
ENV PATH="$VENV_PATH/bin:$POETRY_HOME/bin:$PATH"
FROM python-base as builder-base
# install locales for en_us.utf-8
RUN apt-get update && apt-get install -y \
dialog \
apt-utils \
locales \
&& rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LC_ALL en_US.utf-8
ENV LANG en_US.utf-8
# Install poetry version $POETRY_VERSION to $POETRY_HOME
RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel \
&& python3 -m venv "$POETRY_HOME" \
&& "$POETRY_HOME/bin/pip" install --no-cache-dir poetry=="$POETRY_VERSION"
# copy project requirement files here to ensure they will be cached.
WORKDIR $PYSETUP_PATH
COPY pyproject.toml poetry.lock ./
# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally
RUN poetry install --only main --no-root
# `production` image is used for deployed runtime environments
FROM python-base as production
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
COPY . /docs
WORKDIR /docs