1
- FROM osgeo/gdal:ubuntu-small-3.5.0 as base
1
+ FROM osgeo/gdal:ubuntu-small-3.5.0 as base-all
2
+ LABEL maintainer Camptocamp "info@camptocamp.com"
3
+ SHELL ["/bin/bash" , "-o" , "pipefail" , "-cux" ]
2
4
3
- RUN --mount=type=cache,target=/var/lib/apt/lists,id=apt-list \
5
+ RUN --mount=type=cache,target=/var/lib/apt/lists \
6
+ --mount=type=cache,target=/var/cache,sharing=locked \
4
7
apt-get update \
5
- && apt-get upgrade --yes
8
+ && apt-get upgrade --assume-yes \
9
+ && DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends python3-pip
6
10
7
- SHELL ["/bin/bash" , "-o" , "pipefail" , "-cux" ]
11
+ # Used to convert the locked packages by poetry to pip requirements format
12
+ # We don't directly use `poetry install` because it force to use a virtual environment.
13
+ FROM base-all as poetry
14
+
15
+ # Install Poetry
16
+ WORKDIR /tmp
17
+ COPY requirements.txt ./
18
+ RUN --mount=type=cache,target=/root/.cache \
19
+ python3 -m pip install --disable-pip-version-check --requirement=requirements.txt
8
20
9
- FROM base as builder
21
+ # Do the conversion
22
+ COPY poetry.lock pyproject.toml ./
23
+ RUN poetry export --output=requirements.txt \
24
+ && poetry export --extras=desktop --output=requirements-desktop.txt
25
+
26
+ # Base, the biggest thing is to install the Python packages
27
+ FROM base-all as builder
10
28
LABEL maintainer="info@camptocamp.com"
11
29
30
+ SHELL ["/bin/bash" , "-o" , "pipefail" , "-cux" ]
31
+
12
32
RUN --mount=type=cache,target=/var/lib/apt/lists,id=apt-list \
13
33
--mount=type=cache,target=/var/cache,id=var-cache,sharing=locked \
14
- . /etc/os-release \
34
+ apt-get update \
35
+ && . /etc/os-release \
15
36
&& apt-get install --assume-yes --no-install-recommends apt-utils software-properties-common \
16
37
&& apt-get autoremove --assume-yes software-properties-common \
17
38
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends cmake gcc \
@@ -20,7 +41,7 @@ RUN --mount=type=cache,target=/var/lib/apt/lists,id=apt-list \
20
41
libqt5scintilla2-dev libqt5opengl5-dev libqt5sql5-sqlite libqt5webkit5-dev qtpositioning5-dev \
21
42
qtxmlpatterns5-dev-tools libqt5xmlpatterns5-dev libqt5svg5-dev libqwt-qt5-dev libspatialindex-dev \
22
43
libspatialite-dev libsqlite3-dev libqt5designer5 qttools5-dev qt5keychain-dev lighttpd locales \
23
- pkg-config poppler-utils python3 python3-dev python3-pip python3-setuptools \
44
+ pkg-config poppler-utils python3 python3-dev python3-pip \
24
45
pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-pyqt5.qtsql python3-pyqt5.qsci python3-pyqt5.qtpositioning \
25
46
python3-sip python3-sip-dev qtscript5-dev spawn-fcgi xauth xfonts-100dpi \
26
47
xfonts-75dpi xfonts-base xfonts-scalable xvfb git ninja-build ccache clang libpython3-dev \
@@ -38,16 +59,9 @@ RUN npm install
38
59
39
60
WORKDIR /tmp
40
61
41
- COPY requirements.txt ./
42
- # hadolint ignore=DL3042
43
- RUN --mount=type=cache,target=/root/.cache,id=root-cache \
44
- python3 -m pip install --disable-pip-version-check --requirement=requirements.txt \
45
- && rm --recursive --force /tmp/*
46
-
47
- COPY Pipfile Pipfile.lock ./
48
- RUN --mount=type=cache,target=/root/.cache,id=root-cache \
49
- pipenv sync --system --dev \
50
- && rm --recursive --force /usr/local/lib/python3.*/dist-packages/tests/ /tmp/* /root/.cache/* \
62
+ RUN --mount=type=cache,target=/root/.cache \
63
+ --mount=type=bind,from=poetry,source=/tmp,target=/poetry \
64
+ python3 -m pip install --disable-pip-version-check --no-deps --requirement=/poetry/requirements.txt \
51
65
&& (strip /usr/local/lib/python3.*/dist-packages/*/*.so || true)
52
66
53
67
RUN ln -s /usr/local/lib/libproj.so.* /usr/local/lib/libproj.so
@@ -115,36 +129,29 @@ RUN --mount=type=cache,target=/root/.ccache,id=ccache \
115
129
116
130
RUN ninja install
117
131
118
- FROM base as runner
132
+ FROM base-all as runner
119
133
LABEL maintainer="info@camptocamp.com"
120
134
121
135
RUN --mount=type=cache,target=/var/lib/apt/lists,id=apt-list \
122
136
--mount=type=cache,target=/var/cache,id=var-cache,sharing=locked \
123
- DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends \
124
- libfcgi libgslcblas0 libqca-qt5-2 libqca-qt5-2-plugins libzip5 \
125
- libqt5opengl5 libqt5sql5-sqlite libqt5concurrent5 libqt5positioning5 libqt5script5 \
126
- libqt5webkit5 libqwt-qt5-6 libspatialindex6 libspatialite7 libsqlite3-0 libqt5keychain1 \
127
- python3 python3-pip python3-setuptools \
128
- python3-pyqt5 python3-pyqt5.qtsql python3-pyqt5.qsci python3-pyqt5.qtpositioning \
129
- spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb \
130
- apache2 libapache2-mod-fcgid python3 \
131
- libqt5serialport5 libqt5quickwidgets5 libexiv2-27 libprotobuf17 libprotobuf-lite17 \
132
- libgsl23 libzstd1 binutils \
137
+ apt-get update \
138
+ && DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends \
139
+ libfcgi libgslcblas0 libqca-qt5-2 libqca-qt5-2-plugins libzip5 \
140
+ libqt5opengl5 libqt5sql5-sqlite libqt5concurrent5 libqt5positioning5 libqt5script5 \
141
+ libqt5webkit5 libqwt-qt5-6 libspatialindex6 libspatialite7 libsqlite3-0 libqt5keychain1 \
142
+ python3 python3-pip \
143
+ python3-pyqt5 python3-pyqt5.qtsql python3-pyqt5.qsci python3-pyqt5.qtpositioning \
144
+ spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb \
145
+ apache2 libapache2-mod-fcgid python3 \
146
+ libqt5serialport5 libqt5quickwidgets5 libexiv2-27 libprotobuf17 libprotobuf-lite17 \
147
+ libgsl23 libzstd1 binutils \
133
148
&& strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
134
149
135
150
WORKDIR /tmp
136
151
137
- COPY requirements.txt ./
138
- # hadolint ignore=DL3042
139
- RUN --mount=type=cache,target=/root/.cache,id=root-cache \
140
- python3 -m pip install --disable-pip-version-check --requirement=requirements.txt \
141
- && rm --recursive --force /tmp/*
142
-
143
- COPY Pipfile Pipfile.lock ./
144
- RUN --mount=type=cache,target=/root/.cache,id=root-cache \
145
- pipenv sync --system \
146
- && rm --recursive --force /usr/local/lib/python3.*/dist-packages/tests/ /tmp/* /root/.cache/* \
147
- && (strip /usr/local/lib/python3.*/dist-packages/*/*.so || true)
152
+ RUN --mount=type=cache,target=/root/.cache \
153
+ --mount=type=bind,from=poetry,source=/tmp,target=/poetry \
154
+ python3 -m pip install --disable-pip-version-check --no-deps --requirement=/poetry/requirements.txt
148
155
149
156
FROM runner as runner-server
150
157
@@ -227,6 +234,10 @@ RUN --mount=type=cache,target=/root/.cache,id=root-cache \
227
234
python3 -m pip install --disable-pip-version-check --requirement=requirements-desktop.txt \
228
235
&& rm --recursive --force /tmp/*
229
236
237
+ RUN --mount=type=cache,target=/root/.cache \
238
+ --mount=type=bind,from=poetry,source=/tmp,target=/poetry \
239
+ python3 -m pip install --disable-pip-version-check --no-deps --requirement=/poetry/requirements-desktop.txt
240
+
230
241
COPY --from=builder-desktop /usr/local/bin /usr/local/bin/
231
242
COPY --from=builder-desktop /usr/local/lib /usr/local/lib/
232
243
COPY --from=builder-desktop /usr/local/share /usr/local/share/
0 commit comments