Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Oct 10, 2024
1 parent f1065fe commit 1e76775
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Dockerfile
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.
Expand All @@ -24,7 +24,7 @@ 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
Expand All @@ -39,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 \
Expand Down Expand Up @@ -103,7 +103,7 @@ EXPOSE 8080
WORKDIR /app/

# The final part
FROM base as runner
FROM base AS runner

COPY . /app/
ARG VERSION=dev
Expand All @@ -118,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.
Expand All @@ -127,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 liboss4-salsa-asound2

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

Check notice

Code scanning / SonarCloud

Arguments in long RUN instructions should be sorted Low

Sort these package names alphanumerically. See more on SonarCloud
COPY .nvmrc /tmp
RUN --mount=type=cache,target=/var/lib/apt/lists \
--mount=type=cache,target=/var/cache,sharing=locked \
Expand All @@ -139,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 \
Expand Down

0 comments on commit 1e76775

Please sign in to comment.