forked from equinor/witsml-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-api
28 lines (25 loc) · 1.23 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
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /build
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
# Restoring Api.Tests will restore Api + Witsml
RUN dotnet restore Tests/WitsmlExplorer.Api.Tests
COPY Src/ Src/
COPY Tests/Witsml.Tests Tests/Witsml.Tests
COPY Tests/WitsmlExplorer.Api.Tests Tests/WitsmlExplorer.Api.Tests
WORKDIR /build/Tests/
RUN dotnet test -c Release Witsml.Tests --no-restore && \
dotnet test -c Release WitsmlExplorer.Api.Tests --no-restore
WORKDIR /build/Src/WitsmlExplorer.Api
RUN dotnet publish -c Release -o out --no-restore --no-build --no-dependencies
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as base
ARG EXPOSE_PORT=5000
WORKDIR /app
COPY --from=build /build/Src/WitsmlExplorer.Api/out .
RUN adduser --system --no-create-home --disabled-password --uid 1001 witsmlexp
USER 1001
ENV ASPNETCORE_URLS=http://+:${EXPOSE_PORT}
EXPOSE ${EXPOSE_PORT}
ENTRYPOINT ["dotnet", "WitsmlExplorer.Api.dll"]