1
- FROM python:3.11-buster
1
+ # //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
2
+
3
+ ARG PYTHON_VERSION=3.11
4
+
5
+ FROM python:${PYTHON_VERSION}-bookworm
6
+
7
+ # //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
2
8
3
9
ENV PYTHONDONTWRITEBYTECODE 1
4
10
ENV PYTHONUNBUFFERED 1
5
11
12
+ # //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
13
+
6
14
WORKDIR /usr/src/app
7
15
16
+ # //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
17
+
8
18
# Install Poetry
9
19
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
10
20
cd /usr/local/bin && \
@@ -16,9 +26,28 @@ COPY ./pyproject.toml ./poetry.lock* /usr/src/app/
16
26
17
27
# Allow installing dev dependencies to run tests
18
28
ARG INSTALL_DEV=false
19
- RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
29
+ ARG ASTROPY_VERSION="7.0.0"
30
+
31
+ # Optionally "inject" the matrix version of astropy:
32
+ # This modifies pyproject.toml/poetry.lock so that Poetry can pick up that version.
33
+ RUN if [ -n "$ASTROPY_VERSION" ]; then \
34
+ poetry add --lock "astropy==$ASTROPY_VERSION.*" ; \
35
+ fi
36
+
37
+ # Install dependencies (with or without dev)
38
+ RUN bash -c "\
39
+ if [ \" $INSTALL_DEV\" == 'true' ] ; then \
40
+ poetry install --no-root --without docs; \
41
+ else \
42
+ poetry install --no-root --no-dev --without docs; \
43
+ fi \
44
+ "
45
+
46
+ # //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
20
47
21
48
COPY . /usr/src/app
22
49
23
50
# Set the PYTHONPATH environment variable:
24
- ENV PYTHONPATH=/usr/src/app
51
+ ENV PYTHONPATH=/usr/src/app
52
+
53
+ # //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
0 commit comments