diff --git a/2023.3/dotnet-community/Dockerfile b/2023.3/dotnet-community/Dockerfile new file mode 100644 index 00000000..d01682f9 --- /dev/null +++ b/2023.3/dotnet-community/Dockerfile @@ -0,0 +1,71 @@ +ARG DOTNET_BASE_TAG="6.0-bullseye-slim" +FROM mcr.microsoft.com/dotnet/sdk:$DOTNET_BASE_TAG + +ARG DOTNET_INSTALL_SH_REVISION="40434288dc5bbda41eafcbcbbc5c0fbbe028fb30" +ARG DOTNET_CHANNEL_A="7.0" +ARG DOTNET_CHANNEL_B="6.0" +ARG DOTNET_CHANNEL_C="8.0" + +ENV PATH="/opt/qodana:${PATH}" +ENV DOTNET_ROOT="/usr/share/dotnet" +ENV QODANA_DOCKER true + +RUN apt-get update && apt-get install -y git default-jre gnupg2 && \ + rm -rf /var/lib/apt/lists/* && mkdir -p /opt/qodana && \ + mkdir -p /data/project && mkdir -p /data/cache && mkdir -p /data/results && \ + curl -fsSL -o /tmp/dotnet-install.sh \ + "https://raw.githubusercontent.com/dotnet/install-scripts/$DOTNET_INSTALL_SH_REVISION/src/dotnet-install.sh" && \ + echo "d9ede6126a6da49cd3509e5fc8236f79addf175696f29d01f38840fd84663514 /tmp/dotnet-install.sh" > /tmp/shasum && \ + if [ "${DOTNET_INSTALL_SH_REVISION}" != "master" ]; then sha256sum --check --status /tmp/shasum; fi && \ + chmod +x /tmp/dotnet-install.sh && \ + bash /tmp/dotnet-install.sh -c $DOTNET_CHANNEL_A -i $DOTNET_ROOT && \ + bash /tmp/dotnet-install.sh -c $DOTNET_CHANNEL_B -i $DOTNET_ROOT && \ + bash /tmp/dotnet-install.sh -c $DOTNET_CHANNEL_C -i $DOTNET_ROOT && \ + chmod 777 -R $DOTNET_ROOT + +RUN apt-get update && \ + apt-get install -y sudo && \ + useradd -m -u 1001 -U qodana && \ + passwd -d qodana && \ + echo 'qodana ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +ARG QD_RELEASE="2023.3" +ARG QD_BUILD="QDNETC-$QD_RELEASE" +# hadolint ignore=DL3003,SC2043 +RUN set -ex && \ + dpkgArch="$(dpkg --print-architecture)" && \ + case "$dpkgArch" in \ + "amd64") \ + OS_ARCH_SUFFIX=""; \ + ;; \ + "arm64") \ + OS_ARCH_SUFFIX="-aarch64"; \ + ;; \ + *) echo "Unsupported architecture $dpkgArch" >&2; exit 1 ;; \ + esac && \ + QD_NAME="qodana-$QD_BUILD$OS_ARCH_SUFFIX" \ + QD_URL="https://download.jetbrains.com/qodana/$QD_RELEASE/$QD_NAME.tar.gz" && \ + curl -fsSL "$QD_URL" -o "/tmp/$QD_NAME.tar.gz" \ + "$QD_URL.sha256" -o "/tmp/$QD_NAME.tar.gz.sha256" \ + "$QD_URL.sha256.asc" -o "/tmp/$QD_NAME.tar.gz.sha256.asc" && \ + GNUPGHOME="$(mktemp -d)" && \ + export GNUPGHOME && \ + for key in \ + "B46DC71E03FEEB7F89D1F2491F7A8F87B9D8F501" \ + ; do \ + gpg --batch --keyserver "hkps://keys.openpgp.org" --recv-keys "$key" || \ + gpg --batch --keyserver "keyserver.ubuntu.com" --recv-keys "$key" ; \ + done && \ + gpg --verify "/tmp/$QD_NAME.tar.gz.sha256.asc" "/tmp/$QD_NAME.tar.gz.sha256" && \ + (cd /tmp && sha256sum --check --status "$QD_NAME.tar.gz.sha256") && \ + mkdir -p /tmp/qd && tar -xzf "/tmp/$QD_NAME.tar.gz" --directory /opt/qodana && \ + mv /opt/qodana/qodana-cdnet /opt/qodana/qodana && \ + chmod +x /opt/qodana/qodana && \ + apt-get purge --auto-remove -y gnupg2 && \ + rm -rf /var/cache/apt /var/lib/apt/ /tmp/* "$GNUPGHOME" + +ENV PATH="/opt/qodana:${PATH}" + +LABEL maintainer="qodana-support@jetbrains.com" description="Qodana for .NET Community" +WORKDIR /data/project +ENTRYPOINT ["qodana", "scan"]