forked from exceptionless/Exceptionless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (42 loc) · 1.52 KB
/
Dockerfile
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM mcr.microsoft.com/dotnet/core/sdk:2.2.401 AS build
WORKDIR /app
ARG VERSION_SUFFIX=0-dev
ENV VERSION_SUFFIX=$VERSION_SUFFIX
COPY ./*.sln ./NuGet.Config ./
COPY ./build/*.props ./build/
# Copy the main source project files
COPY src/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p src/${file%.*}/ && mv $file src/${file%.*}/; done
# Copy the test project files
COPY tests/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p tests/${file%.*}/ && mv $file tests/${file%.*}/; done
RUN dotnet restore
# Copy everything else and build app
COPY . .
RUN dotnet build --version-suffix $VERSION_SUFFIX -c Release
# testrunner
FROM build AS testrunner
WORKDIR /app/tests/Exceptionless.Tests
ENTRYPOINT dotnet test --results-directory /app/artifacts --logger:trx
# job-publish
FROM build AS job-publish
WORKDIR /app/src/Exceptionless.Job
ARG VERSION_SUFFIX=0-dev
ENV VERSION_SUFFIX=$VERSION_SUFFIX
RUN dotnet publish --version-suffix $VERSION_SUFFIX -c Release -o out
# job
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS job
WORKDIR /app
COPY --from=job-publish /app/src/Exceptionless.Job/out ./
ENTRYPOINT [ "dotnet", "Exceptionless.Job.dll" ]
# api-publish
FROM build AS api-publish
WORKDIR /app/src/Exceptionless.Web
ARG VERSION_SUFFIX=0-dev
ENV VERSION_SUFFIX=$VERSION_SUFFIX
RUN dotnet publish --version-suffix $VERSION_SUFFIX -c Release -o out
# api
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS api
WORKDIR /app
COPY --from=api-publish /app/src/Exceptionless.Web/out ./
ENTRYPOINT [ "dotnet", "Exceptionless.Web.dll" ]