@@ -4,40 +4,30 @@ LABEL maintainer="CNES"
4
4
5
5
# Dependencies packages
6
6
# hadolint ignore=DL3008
7
- RUN apt-get update && apt-get install --no-install-recommends software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa && rm -rf /var/lib/apt/lists/*
7
+ RUN apt-get update \
8
+ && apt-get install --no-install-recommends software-properties-common -y \
9
+ && add-apt-repository ppa:deadsnakes/ppa && rm -rf /var/lib/apt/lists/*
8
10
11
+ # Python 3.10
9
12
# hadolint ignore=DL3008
10
- RUN apt-get update && apt-get install --no-install-recommends -y --quiet \
11
- git \
12
- libpython3.10 \
13
- python3.10-dev \
14
- python3.10-venv \
15
- python3.10 \
16
- python3-pip \
17
- python3-numpy \
18
- python3-virtualenv \
13
+ RUN apt-get update && apt-get install --no-install-recommends -y --quiet git python3.10-dev \
19
14
&& rm -rf /var/lib/apt/lists/*
20
-
21
- # copy and install cars with mccnn plugin capabilities installed (but not configured by default)
22
- WORKDIR /app
23
-
24
- # Create a virtual environment
25
- RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && python3 -m venv /app/venv
26
-
27
- # source venv/bin/activate in docker mode
28
- ENV VIRTUAL_ENV='/app/venv'
29
-
30
- # Copy only necessary files for installation
31
- COPY . /app/cars
32
-
33
- # Install fiona and rasterio with gdal / proj from otb
34
- WORKDIR /app/cars
35
- RUN echo "CARS installation" && CARS_VENV=$VIRTUAL_ENV make clean && CARS_VENV=$VIRTUAL_ENV make install/dev-gdal
36
- ENV PATH="$VIRTUAL_ENV/bin:$PATH"
37
-
38
- # hadolint ignore=DL3013,SC2102
39
- RUN python -m pip cache purge
40
-
41
- # launch cars
15
+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
16
+
17
+ # Install dependancies
18
+ SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
19
+ # hadolint ignore=DL3013
20
+ RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 \
21
+ && python3 -m pip install --no-cache-dir --upgrade requests \
22
+ && python3 -m pip install --no-cache-dir --no-binary fiona fiona \
23
+ && python3 -m pip install --no-cache-dir --no-binary rasterio rasterio
24
+
25
+ # Install cars: from source or from pypi if version
26
+ ARG version
27
+ # hadolint ignore=DL3003,DL3013
28
+ RUN if [ -z "$version" ] ; then git clone --depth 1 https://github.com/CNES/cars.git && cd cars && python3 -m pip install --no-cache-dir build && python3 -m build && python3 -m pip install --no-cache-dir dist/*.whl && cd - && rm -rf cars; \
29
+ else python3 -m pip install --no-cache-dir cars==$version; fi
30
+
31
+ # Launch cars
42
32
ENTRYPOINT ["cars" ]
43
33
CMD ["-h" ]
0 commit comments