Skip to content

Commit

Permalink
Dockerfile cleanup with DotNetCore 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gafda committed Oct 29, 2020
1 parent a57e644 commit e464097
Showing 1 changed file with 21 additions and 36 deletions.
57 changes: 21 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1.301
FROM mcr.microsoft.com/dotnet/core/sdk:2.2.207

# Dockerfile meta-information
LABEL maintainer="NOS Inovação S.A." \
app_name="dotnet-sonar"

# Reviewing this choices
ENV SONAR_SCANNER_MSBUILD_VERSION=4.10.0.19059 \
DOTNETCORE_SDK=3.1.301 \
DOTNETCORE_RUNTIME=3.1.5 \
DOCKER_VERSION=5:19.03.12~3-0~debian-buster \
CONTAINERD_VERSION=1.2.13-2

DOTNETCORE_SDK=2.2.207 \
DOTNETCORE_RUNTIME=2.2.8 \
NETCOREAPP_VERSION=netcoreapp2.0 \
DOCKER_VERSION=5:19.03.2~3-0~debian-stretch \
CONTAINERD_VERSION=1.2.13-2 \
OPENJDK_VERSION=8

# Linux update
RUN apt-get update \
&& apt-get dist-upgrade -y

# Install all necessary additional software (utils, jre, docker binaries)
RUN apt-get install -y \
openjdk-11-jre \
&& apt-get dist-upgrade -y \
&& apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
software-properties-common

# Install Java
RUN apt-get install -y openjdk-$OPENJDK_VERSION-jre

# Install all necessary additional software
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
&& apt-key fingerprint 0EBFCD88 \
&& add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
Expand All @@ -34,33 +38,14 @@ RUN apt-get install -y \
docker-ce-cli=$DOCKER_VERSION \
containerd.io=$CONTAINERD_VERSION

# install nodejs
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y \
nodejs \
autoconf \
libtool \
nasm

# Register Microsoft key and feed
RUN wget -q https://packages.microsoft.com/config/ubuntu/19.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb

# Install DotNetCore 3.1 Runtime-Only for SonarScanner
RUN apt-get update -y \
&& apt-get install apt-transport-https -y \
&& apt-get update -y \
&& apt-get install aspnetcore-runtime-3.1 -y

# Install Sonar Scanner
RUN apt-get install -y unzip \
&& wget https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/$SONAR_SCANNER_MSBUILD_VERSION/sonar-scanner-msbuild-$SONAR_SCANNER_MSBUILD_VERSION-netcoreapp3.0.zip \
&& unzip sonar-scanner-msbuild-$SONAR_SCANNER_MSBUILD_VERSION-netcoreapp3.0.zip -d /sonar-scanner \
&& rm sonar-scanner-msbuild-$SONAR_SCANNER_MSBUILD_VERSION-netcoreapp3.0.zip \
&& wget https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/$SONAR_SCANNER_MSBUILD_VERSION/sonar-scanner-msbuild-$SONAR_SCANNER_MSBUILD_VERSION-$NETCOREAPP_VERSION.zip \
&& unzip sonar-scanner-msbuild-$SONAR_SCANNER_MSBUILD_VERSION-$NETCOREAPP_VERSION.zip -d /sonar-scanner \
&& rm sonar-scanner-msbuild-$SONAR_SCANNER_MSBUILD_VERSION-$NETCOREAPP_VERSION.zip \
&& chmod +x -R /sonar-scanner

# Cleanup
RUN apt-get -q autoremove \
&& apt-get -q clean -y \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*.bin

0 comments on commit e464097

Please sign in to comment.