forked from equinor/witsml-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-api
29 lines (25 loc) · 1.1 KB
/
Dockerfile-api
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
FROM mcr.microsoft.com/dotnet/sdk:5.0 as base
WORKDIR /app
COPY Src/Witsml/Witsml.csproj Src/Witsml/Witsml.csproj
COPY Src/WitsmlExplorer.Api/WitsmlExplorer.Api.csproj Src/WitsmlExplorer.Api/WitsmlExplorer.Api.csproj
COPY Tests/Witsml.Tests/Witsml.Tests.csproj Tests/Witsml.Tests/Witsml.Tests.csproj
COPY Tests/WitsmlExplorer.Api.Tests/WitsmlExplorer.Api.Tests.csproj Tests/WitsmlExplorer.Api.Tests/WitsmlExplorer.Api.Tests.csproj
RUN dotnet restore Src/Witsml && \
dotnet restore Src/WitsmlExplorer.Api
FROM base as backend
WORKDIR /app
COPY Src/ Src/
COPY Tests/Witsml.Tests Tests/Witsml.Tests
COPY Tests/WitsmlExplorer.Api.Tests Tests/WitsmlExplorer.Api.Tests
WORKDIR /app/Tests/
RUN dotnet test -c Release Witsml.Tests && \
dotnet test -c Release WitsmlExplorer.Api.Tests
FROM backend as publish
WORKDIR /app/Src/WitsmlExplorer.Api
RUN dotnet publish -c Release -o out --no-restore --no-build --no-dependencies
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=publish /app/Src/WitsmlExplorer.Api/out .
ENV ASPNETCORE_URLS=http://+:80
EXPOSE 80
ENTRYPOINT ["dotnet", "WitsmlExplorer.Api.dll"]