-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
39 lines (31 loc) · 997 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
31
32
33
34
35
36
37
38
39
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
# EXPOSE 5000
# ENV ASPNETCORE_URLS=http://+:5000
#
# copy csproj and restore as distinct layers
COPY *.sln .
COPY Demo/Client/*.csproj ./Demo/Client/
COPY Demo/Hub/*.csproj ./Demo/Hub/
#
RUN dotnet restore Demo/Hub/DemoHub.csproj
#
# copy everything else and build app
COPY Demo/Client/. ./Demo/Client/
COPY Demo/Hub/. ./Demo/Hub/
COPY Demo/Test/. ./Demo/Test/
#
WORKDIR /app/Demo/Hub/
RUN dotnet publish DemoHub.csproj -c Release -o out
#
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
# copy test databases: main_db & user_db
COPY --from=build /app/Demo/Test/DB /Test/DB
COPY Demo/Hub/bin/Release/net8.0/*.xml /app/
WORKDIR /app
#
COPY --from=build /app/Demo/Hub/out ./
ENTRYPOINT ["dotnet", "DemoHub.dll"]
# --- usage
# docker build -t demo-hub:latest .
# docker run -it --rm -p 80:5000 demo-hub:latest