1- # Container to install npm dependencies
2- FROM ubuntu:24.04 AS node-deps
3-
4- RUN apt-get update && apt-get install -y npm && apt-get clean && rm -rf /var/lib/apt/lists/*
5-
6- WORKDIR /welkin-test
7- COPY ./tests/package.json ./tests/package-lock.json ./
8- RUN npm install --global --omit dev
9-
101# Container to run unit tests
112FROM ubuntu:24.04 AS unit
123LABEL org.opencontainers.image.source=https://github.com/elastisys/compliantkubernetes-apps
@@ -16,15 +7,12 @@ ENV LANGUAGE="en"
167ENV LANG="en_US.utf8"
178ARG TZ="Etc/UTC"
189
19- RUN apt-get update && \
20- apt-get upgrade -y && \
21- apt-get install -y apache2-utils curl dnsutils gettext-base git gpg iputils-ping jq locales make net-tools nodejs parallel pwgen python3-venv s3cmd ssh unzip && \
10+ RUN apt-get update -q=2 && \
11+ apt-get install -q=2 apache2-utils curl dnsutils gettext-base git gpg iputils-ping jq locales make net-tools nodejs parallel pwgen python3-venv s3cmd ssh unzip && \
2212 apt-get clean && \
2313 rm -rf /var/lib/apt/lists/* && \
2414 localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
2515
26- ENV NODE_PATH="/usr/local/lib/node_modules"
27-
2816ARG GOMPLATE_VERSION="4.3.1"
2917RUN curl -LOs "https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64" && \
3018 install -Tm 755 gomplate_linux-amd64 /usr/local/bin/gomplate && \
@@ -110,9 +98,7 @@ RUN git clone --depth 1 --recurse-submodules --shallow-submodules https://github
11098 /opt/docs-venv/bin/python -m pip install --upgrade pip && \
11199 cd "${DOCS_PATH}" && \
112100 /opt/docs-venv/bin/pip install --no-cache-dir -r requirements.txt
113-
114- ENV PATH="/opt/docs-venv/bin:${PATH}:/usr/local/lib/node_modules/.bin"
115- COPY --from=node-deps /usr/local/lib/node_modules/welkin-test/node_modules /usr/local/lib/node_modules
101+ ENV PATH="/opt/docs-venv/bin:${PATH}"
116102
117103# Container to run integration and end-to-end tests
118104FROM unit AS main
@@ -130,8 +116,8 @@ Architectures: $(dpkg --print-architecture) \n\
130116Signed-by: /etc/apt/keyrings/microsoft.gpg" | tee /etc/apt/sources.list.d/azure-cli.sources
131117
132118ARG AZ_VERSION=2.63.0
133- RUN apt-get update && \
134- apt-get install -y azure-cli=${AZ_VERSION}-1~${DIST} buildah docker.io libasound2t64 libatk1.0-0 libatk-bridge2.0-0 libcanberra-gtk-module \
119+ RUN apt-get update -q=2 && \
120+ apt-get install -q=2 azure-cli=${AZ_VERSION}-1~${DIST} buildah docker.io libasound2t64 libatk1.0-0 libatk-bridge2.0-0 libcanberra-gtk-module \
135121 libcanberra-gtk3-module libcups2 libgbm-dev libgbm1 libglib2.0-0 libgtk2.0-0 libgtk2.0-0t64 libgtk-3-0 \
136122 libgtk-3-0t64 libnotify-dev libnss3 libxss1 libxtst6 podman-remote skopeo socat xauth xvfb zstd && \
137123 apt-get clean && \
@@ -149,6 +135,13 @@ RUN curl -LOs "https://github.com/vmware-tanzu/velero/releases/download/v${VELER
149135 install -Tm 755 "velero-v${VELERO_VERSION}-linux-amd64/velero" /usr/local/bin/velero && \
150136 rm -r "velero-v${VELERO_VERSION}-linux-amd64.tar.gz" "velero-v${VELERO_VERSION}-linux-amd64"
151137
152- ENV PATH="$PATH:/usr/local/lib/node_modules/.bin"
138+ ENV NODE_PATH="/usr/local/lib/node_modules"
139+ ENV PATH="${PATH}:${NODE_PATH}/.bin"
140+
141+ COPY ./tests/package.json ./tests/package-lock.json ./
142+ RUN apt-get update -q=2 && apt-get install -q=2 npm && \
143+ npm ci --omit dev && mv node_modules /usr/local/lib/ && \
144+ apt-get autoremove --purge npm -q=2 && rm -rf /var/lib/apt/lists/* && rm -rf /root/.cache
145+
153146ENV CYPRESS_CACHE_FOLDER=/usr/local/lib/cypress
154147RUN cypress install && cypress verify
0 commit comments