forked from diwise/ingress-mqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
30 lines (26 loc) · 800 Bytes
/
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
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
WORKDIR /app
COPY *.sln .
COPY Masarin.IoT.Sensor/*.csproj ./Masarin.IoT.Sensor/
COPY Masarin.IoT.Sensor.Tests/*.csproj ./Masarin.IoT.Sensor.Tests/
RUN dotnet restore
# copy full solution over
COPY . .
RUN dotnet build
FROM build AS testrunner
WORKDIR /app/Masarin.IoT.Sensor.Tests
CMD ["dotnet", "test", "--logger:trx"]
# run the unit tests
FROM build AS test
WORKDIR /app/Masarin.IoT.Sensor.Tests
RUN dotnet test --logger:trx
# publish the API
FROM build AS publish
WORKDIR /app/Masarin.IoT.Sensor/
RUN dotnet publish -c Release -o out
# run the api
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS runtime
WORKDIR /app
COPY --from=publish /app/Masarin.IoT.Sensor/out ./
EXPOSE 80
ENTRYPOINT ["dotnet", "Masarin.IoT.Sensor.dll"]