-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2555 from camptocamp/modernize
Prepare the upgrade to Ubuntu 24.04
- Loading branch information
Showing
4 changed files
with
90 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Base of all section, install the apt packages | ||
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.8.5 as base-all | ||
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.8.5 AS base-all | ||
LABEL maintainer Camptocamp "[email protected]" | ||
|
||
# Fail on error on pipe, see: https://github.com/hadolint/hadolint/wiki/DL4006. | ||
|
@@ -17,11 +17,14 @@ RUN --mount=type=cache,target=/var/lib/apt/lists \ | |
fonts-dejavu \ | ||
optipng jpegoptim \ | ||
postgresql-client net-tools iputils-ping \ | ||
python3-pip | ||
python3-pip python3-venv \ | ||
&& python3 -m venv /venv | ||
|
||
ENV PATH=/venv/bin:$PATH | ||
|
||
# Used to convert the locked packages by poetry to pip requirements format | ||
# We don't directly use `poetry install` because it force to use a virtual environment. | ||
FROM base-all as poetry | ||
FROM base-all AS poetry | ||
|
||
# Install Poetry | ||
WORKDIR /tmp | ||
|
@@ -36,7 +39,7 @@ RUN poetry export --output=requirements.txt \ | |
&& poetry export --with=dev --output=requirements-dev.txt | ||
|
||
# Base, the biggest thing is to install the Python packages | ||
FROM base-all as base | ||
FROM base-all AS base | ||
|
||
# hadolint ignore=SC2086 | ||
RUN --mount=type=cache,target=/var/lib/apt/lists \ | ||
|
@@ -47,8 +50,8 @@ RUN --mount=type=cache,target=/var/lib/apt/lists \ | |
&& apt-get update \ | ||
&& apt-get install --assume-yes --no-install-recommends ${DEV_PACKAGES} \ | ||
&& python3 -m pip install --disable-pip-version-check --no-deps --requirement=/poetry/requirements.txt \ | ||
&& python3 -m compileall /usr/local/lib/python* /usr/lib/python* \ | ||
&& strip /usr/local/lib/python*/dist-packages/shapely/*.so \ | ||
&& python3 -m compileall /venv/lib/python* /usr/lib/python* \ | ||
&& strip /venv/lib/python*/site-packages/shapely/*.so \ | ||
&& apt-get remove --purge --autoremove --yes ${DEV_PACKAGES} binutils | ||
|
||
# From c2cwsgiutils | ||
|
@@ -100,7 +103,7 @@ EXPOSE 8080 | |
WORKDIR /app/ | ||
|
||
# The final part | ||
FROM base as runner | ||
FROM base AS runner | ||
|
||
COPY . /app/ | ||
ARG VERSION=dev | ||
|
@@ -115,7 +118,7 @@ RUN mkdir -p /prometheus-metrics \ | |
ENV PROMETHEUS_MULTIPROC_DIR=/prometheus-metrics | ||
|
||
# Do the lint, used by the tests | ||
FROM base as tests | ||
FROM base AS tests | ||
|
||
# Fail on error on pipe, see: https://github.com/hadolint/hadolint/wiki/DL4006. | ||
# Treat unset variables as an error when substituting. | ||
|
@@ -124,10 +127,11 @@ SHELL ["/bin/bash", "-o", "pipefail", "-cux"] | |
|
||
RUN --mount=type=cache,target=/var/lib/apt/lists \ | ||
--mount=type=cache,target=/var/cache,sharing=locked \ | ||
apt-get install --assume-yes --no-install-recommends git curl gnupg \ | ||
libglib2.0-0 libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 \ | ||
libxdamage1 libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 | ||
|
||
apt-get update \ | ||
&& apt-get install --assume-yes --no-install-recommends software-properties-common gpg-agent \ | ||
&& add-apt-repository ppa:savoury1/pipewire \ | ||
&& add-apt-repository ppa:savoury1/chromium \ | ||
&& apt-get install --assume-yes --no-install-recommends chromium-browser git curl gnupg | ||
COPY .nvmrc /tmp | ||
RUN --mount=type=cache,target=/var/lib/apt/lists \ | ||
--mount=type=cache,target=/var/cache,sharing=locked \ | ||
|
@@ -136,9 +140,9 @@ RUN --mount=type=cache,target=/var/lib/apt/lists \ | |
&& curl --silent https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor --output=/etc/apt/keyrings/nodesource.gpg \ | ||
&& apt-get update \ | ||
&& apt-get install --assume-yes --no-install-recommends "nodejs=${NODE_MAJOR}.*" | ||
|
||
COPY package.json package-lock.json ./ | ||
RUN npm install --dev | ||
RUN npm install --dev --ignore-scripts | ||
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser | ||
|
||
RUN --mount=type=cache,target=/root/.cache \ | ||
--mount=type=bind,from=poetry,source=/tmp,target=/poetry \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.