From ed52b27a01547406cca6e4e000343b438161166b Mon Sep 17 00:00:00 2001 From: tiulpin Date: Mon, 4 Sep 2023 17:42:57 +0200 Subject: [PATCH] QD-4594 Unify multiple images for better caches --- .github/workflows/ci.yml | 2 ++ 2023.2/android-community/Dockerfile | 4 ++-- 2023.2/dotnet/Dockerfile | 6 +++--- 2023.2/go/Dockerfile | 6 +++--- 2023.2/js/Dockerfile | 7 ++++--- 2023.2/jvm-community/Dockerfile | 4 ++-- 2023.2/jvm/Dockerfile | 21 +++++++++------------ 2023.2/php/Dockerfile | 16 +++++++++------- 2023.2/python-community/Dockerfile | 4 ++-- 2023.2/python/Dockerfile | 16 +++++++--------- 10 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 621c86be..83dfe7eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,3 +33,5 @@ jobs: context: ${{ matrix.version }}/${{ matrix.linter }} platforms: ${{ matrix.platform }} push: false + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/2023.2/android-community/Dockerfile b/2023.2/android-community/Dockerfile index 2e608f38..7955523b 100644 --- a/2023.2/android-community/Dockerfile +++ b/2023.2/android-community/Dockerfile @@ -7,8 +7,8 @@ ENV HOME="/root" \ QODANA_DATA="/data" \ QODANA_DOCKER="true" ENV JAVA_HOME="$QODANA_DIST/jbr" \ - QODANA_CONF="$HOME/.config/idea" -ENV PATH="$QODANA_DIST/bin:$PATH" + QODANA_CONF="$HOME/.config/idea" \ + PATH="$QODANA_DIST/bin:$PATH" # hadolint ignore=SC2174 RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ diff --git a/2023.2/dotnet/Dockerfile b/2023.2/dotnet/Dockerfile index e5e80264..c275b46d 100644 --- a/2023.2/dotnet/Dockerfile +++ b/2023.2/dotnet/Dockerfile @@ -10,7 +10,8 @@ ENV HOME="/root" \ QODANA_DATA="/data" \ QODANA_DOCKER="true" ENV JAVA_HOME="$QODANA_DIST/jbr" \ - QODANA_CONF="$HOME/.config/idea" + QODANA_CONF="$HOME/.config/idea" \ + PATH="$QODANA_DIST/bin:$PATH" ENV RIDER_UNREAL_ROOT="/data/unrealEngine" DOTNET_ROOT="/usr/share/dotnet" @@ -19,8 +20,6 @@ ARG DOTNET_INSTALL_SH_REVISION="40434288dc5bbda41eafcbcbbc5c0fbbe028fb30" ARG DOTNET_CHANNEL_A="7.0" ARG DOTNET_CHANNEL_B="6.0" -ENV PATH="$QODANA_DIST/bin:/opt/yarn/bin:$PATH" - # hadolint ignore=SC2174 RUN mkdir -m 777 -p $QODANA_DATA $QODANA_CONF $DOTNET_ROOT $RIDER_UNREAL_ROOT && apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ @@ -48,6 +47,7 @@ RUN mkdir -m 777 -p $QODANA_DATA $QODANA_CONF $DOTNET_ROOT $RIDER_UNREAL_ROOT && chmod 777 -R $DOTNET_ROOT && \ rm -rf /var/cache/apt /var/lib/apt/ /tmp/* +ENV PATH="/opt/yarn/bin:$PATH" COPY --from=node_base /usr/local/bin/node /usr/local/bin/ COPY --from=node_base /usr/local/include/node /usr/local/include/node COPY --from=node_base /usr/local/lib/node_modules /usr/local/lib/node_modules diff --git a/2023.2/go/Dockerfile b/2023.2/go/Dockerfile index 6eef67b5..edaae810 100644 --- a/2023.2/go/Dockerfile +++ b/2023.2/go/Dockerfile @@ -10,9 +10,8 @@ ENV HOME="/root" \ QODANA_DATA="/data" \ QODANA_DOCKER="true" ENV JAVA_HOME="$QODANA_DIST/jbr" \ - QODANA_CONF="$HOME/.config/idea" - -ENV PATH="$QODANA_DIST/bin:/opt/yarn/bin:$PATH" + QODANA_CONF="$HOME/.config/idea"\ + PATH="$QODANA_DIST/bin:$PATH" # hadolint ignore=SC2174 RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ @@ -32,6 +31,7 @@ RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ git config --global --add safe.directory '*' && \ rm -rf /var/cache/apt /var/lib/apt/ /tmp/* +ENV PATH="/opt/yarn/bin:$PATH" COPY --from=node_base /usr/local/bin/node /usr/local/bin/ COPY --from=node_base /usr/local/include/node /usr/local/include/node COPY --from=node_base /usr/local/lib/node_modules /usr/local/lib/node_modules diff --git a/2023.2/js/Dockerfile b/2023.2/js/Dockerfile index 3fb2cb52..889a7f4e 100644 --- a/2023.2/js/Dockerfile +++ b/2023.2/js/Dockerfile @@ -7,9 +7,8 @@ ENV HOME="/root" \ QODANA_DATA="/data" \ QODANA_DOCKER="true" ENV JAVA_HOME="$QODANA_DIST/jbr" \ - QODANA_CONF="$HOME/.config/idea" - -ENV PATH="$QODANA_DIST/bin:/opt/yarn/bin:$PATH" + QODANA_CONF="$HOME/.config/idea" \ + PATH="$QODANA_DIST/bin:$PATH" # hadolint ignore=SC2174 RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ @@ -31,6 +30,8 @@ RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ chmod 777 -R "$HOME/.npm" "$HOME/.npmrc" && \ rm -rf /var/cache/apt /var/lib/apt/ /tmp/* +ENV PATH="/opt/yarn/bin:$PATH" + ARG QD_BUILD="QDJVM-2023.2" ARG QD_RELEASE="2023.2" # hadolint ignore=DL3003,SC2043 diff --git a/2023.2/jvm-community/Dockerfile b/2023.2/jvm-community/Dockerfile index 5e60fc1a..419902a7 100644 --- a/2023.2/jvm-community/Dockerfile +++ b/2023.2/jvm-community/Dockerfile @@ -7,8 +7,8 @@ ENV HOME="/root" \ QODANA_DATA="/data" \ QODANA_DOCKER="true" ENV JAVA_HOME="$QODANA_DIST/jbr" \ - QODANA_CONF="$HOME/.config/idea" -ENV PATH="$QODANA_DIST/bin:$PATH" + QODANA_CONF="$HOME/.config/idea" \ + PATH="$QODANA_DIST/bin:$PATH" # hadolint ignore=SC2174 RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ diff --git a/2023.2/jvm/Dockerfile b/2023.2/jvm/Dockerfile index dcb54158..a5b515d1 100644 --- a/2023.2/jvm/Dockerfile +++ b/2023.2/jvm/Dockerfile @@ -1,7 +1,4 @@ -ARG NODE_TAG="16-bullseye-slim" ARG BASE_TAG="bullseye-slim" - -FROM node:$NODE_TAG AS node_base FROM debian:$BASE_TAG ENV HOME="/root" \ @@ -10,9 +7,8 @@ ENV HOME="/root" \ QODANA_DATA="/data" \ QODANA_DOCKER="true" ENV JAVA_HOME="$QODANA_DIST/jbr" \ - QODANA_CONF="$HOME/.config/idea" - -ENV PATH="$QODANA_DIST/bin:/opt/yarn/bin:$PATH" + QODANA_CONF="$HOME/.config/idea" \ + PATH="$QODANA_DIST/bin:$PATH" # hadolint ignore=SC2174 RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ @@ -32,12 +28,11 @@ RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ git config --global --add safe.directory '*' && \ rm -rf /var/cache/apt /var/lib/apt/ /tmp/* -ENV GRADLE_USER_HOME="/data/cache/gradle" - -COPY --from=node_base /usr/local/bin/node /usr/local/bin/ -COPY --from=node_base /usr/local/include/node /usr/local/include/node -COPY --from=node_base /usr/local/lib/node_modules /usr/local/lib/node_modules -COPY --from=node_base /opt/yarn-* /opt/yarn/ +ENV PATH="/opt/yarn/bin:$PATH" +COPY --from=node:16-bullseye-slim /usr/local/bin/node /usr/local/bin/ +COPY --from=node:16-bullseye-slim /usr/local/include/node /usr/local/include/node +COPY --from=node:16-bullseye-slim /usr/local/lib/node_modules /usr/local/lib/node_modules +COPY --from=node:16-bullseye-slim /opt/yarn-* /opt/yarn/ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \ ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \ ln -s /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack && \ @@ -47,6 +42,8 @@ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \ npm install -g eslint@v8.47.0 pnpm@v8.7.1 && npm config set update-notifier false && \ chmod 777 -R "$HOME/.npm" "$HOME/.npmrc" +ENV GRADLE_USER_HOME="/data/cache/gradle" + ARG QD_BUILD="QDJVM-2023.2" ARG QD_RELEASE="2023.2" # hadolint ignore=DL3003,SC2043 diff --git a/2023.2/php/Dockerfile b/2023.2/php/Dockerfile index 695644b8..af84bb99 100644 --- a/2023.2/php/Dockerfile +++ b/2023.2/php/Dockerfile @@ -10,8 +10,8 @@ ENV HOME="/root" \ QODANA_DATA="/data" \ QODANA_DOCKER="true" ENV JAVA_HOME="$QODANA_DIST/jbr" \ - QODANA_CONF="$HOME/.config/idea" -ENV PATH="$QODANA_DIST/bin:/opt/yarn/bin:$PATH" + QODANA_CONF="$HOME/.config/idea" \ + PATH="$QODANA_DIST/bin:$PATH" # hadolint ignore=SC2174 RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ @@ -32,11 +32,11 @@ RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ git config --global --add safe.directory '*' && \ rm -rf /var/cache/apt /var/lib/apt/ /tmp/* -COPY --from=composer:2.5.1 /usr/bin/composer /usr/bin/composer -COPY --from=node_base /usr/local/bin/node /usr/local/bin/ -COPY --from=node_base /usr/local/include/node /usr/local/include/node -COPY --from=node_base /usr/local/lib/node_modules /usr/local/lib/node_modules -COPY --from=node_base /opt/yarn-* /opt/yarn/ +ENV PATH="/opt/yarn/bin:$PATH" +COPY --from=node:16-bullseye-slim /usr/local/bin/node /usr/local/bin/ +COPY --from=node:16-bullseye-slim /usr/local/include/node /usr/local/include/node +COPY --from=node:16-bullseye-slim /usr/local/lib/node_modules /usr/local/lib/node_modules +COPY --from=node:16-bullseye-slim /opt/yarn-* /opt/yarn/ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \ ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \ ln -s /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack && \ @@ -46,6 +46,8 @@ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \ npm install -g eslint@v8.47.0 pnpm@v8.7.1 && npm config set update-notifier false && \ chmod 777 -R "$HOME/.npm" "$HOME/.npmrc" +COPY --from=composer:2.5.1 /usr/bin/composer /usr/bin/composer + ARG QD_BUILD="QDPHP-2023.2" ARG QD_RELEASE="2023.2" # hadolint ignore=DL3003,SC2043 diff --git a/2023.2/python-community/Dockerfile b/2023.2/python-community/Dockerfile index 63a8aa60..3fc6a9fb 100644 --- a/2023.2/python-community/Dockerfile +++ b/2023.2/python-community/Dockerfile @@ -7,8 +7,8 @@ ENV HOME="/root" \ QODANA_DATA="/data" \ QODANA_DOCKER="true" ENV JAVA_HOME="$QODANA_DIST/jbr" \ - QODANA_CONF="$HOME/.config/idea" -ENV PATH="$QODANA_DIST/bin:$PATH" + QODANA_CONF="$HOME/.config/idea" \ + PATH="$QODANA_DIST/bin:$PATH" # hadolint ignore=SC2174 RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ diff --git a/2023.2/python/Dockerfile b/2023.2/python/Dockerfile index 9c0f3d0e..65ec681a 100644 --- a/2023.2/python/Dockerfile +++ b/2023.2/python/Dockerfile @@ -1,7 +1,4 @@ -ARG NODE_TAG="16-bullseye-slim" ARG BASE_TAG="bullseye-slim" - -FROM node:$NODE_TAG AS node_base FROM debian:$BASE_TAG ENV HOME="/root" \ @@ -10,8 +7,8 @@ ENV HOME="/root" \ QODANA_DATA="/data" \ QODANA_DOCKER="true" ENV JAVA_HOME="$QODANA_DIST/jbr" \ - QODANA_CONF="$HOME/.config/idea" -ENV PATH="$QODANA_DIST/bin:/opt/yarn/bin:$PATH" + QODANA_CONF="$HOME/.config/idea" \ + PATH="$QODANA_DIST/bin:$PATH" # hadolint ignore=SC2174 RUN mkdir -m 777 -p /opt $QODANA_DATA $QODANA_CONF && apt-get update && \ @@ -69,10 +66,11 @@ RUN apt-get update && \ ${CONDA_DIR}/bin/conda install -c conda-forge poetry pipenv && ${CONDA_DIR}/bin/conda clean -afy && \ rm -rf /var/cache/apt /var/lib/apt/ /tmp/* -COPY --from=node_base /usr/local/bin/node /usr/local/bin/ -COPY --from=node_base /usr/local/include/node /usr/local/include/node -COPY --from=node_base /usr/local/lib/node_modules /usr/local/lib/node_modules -COPY --from=node_base /opt/yarn-* /opt/yarn/ +ENV PATH="/opt/yarn/bin:$PATH" +COPY --from=node:16-bullseye-slim /usr/local/bin/node /usr/local/bin/ +COPY --from=node:16-bullseye-slim /usr/local/include/node /usr/local/include/node +COPY --from=node:16-bullseye-slim /usr/local/lib/node_modules /usr/local/lib/node_modules +COPY --from=node:16-bullseye-slim /opt/yarn-* /opt/yarn/ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \ ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \ ln -s /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack && \