-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile.dev
43 lines (31 loc) · 1.4 KB
/
Dockerfile.dev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
ARG MAIN_PROJECT_SRC=./src
ARG TEST_PROJECT_SRC=./tests
ARG DOTNET_VERSION=7.0
FROM mcr.microsoft.com/dotnet/sdk:$DOTNET_VERSION
# Add Microsoft Debian apt-get feed
RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb
# Fix JRE Install https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
RUN mkdir -p /usr/share/man/man1
# Install the .NET 5 Runtime for SonarScanner
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y apt-transport-https \
&& apt-get update -y \
&& apt-get install --no-install-recommends -y aspnetcore-runtime-5.0
# Install Java Runtime for SonarScanner
RUN apt-get install --no-install-recommends -y openjdk-17-jre
WORKDIR /app
ARG MAIN_PROJECT_SRC
ARG TEST_PROJECT_SRC
# https://github.com/dotnet/dotnet-docker/issues/520
ENV PATH="${PATH}:/root/.dotnet/tools"
# Tools used during development
RUN dotnet tool install --global dotnet-ef
RUN dotnet tool install --global dotnet-format
RUN dotnet tool install --global dotnet-sonarscanner
# Restores (downloads) all NuGet packages from all projects of the solution on a separate layer
COPY ${MAIN_PROJECT_SRC}/*.csproj ${MAIN_PROJECT_SRC}/
COPY ${TEST_PROJECT_SRC}/*.csproj ${TEST_PROJECT_SRC}/
RUN dotnet restore --locked-mode ${MAIN_PROJECT_SRC}
RUN dotnet restore --locked-mode ${TEST_PROJECT_SRC}
COPY . ./