add docker support

This commit is contained in:
2021-02-23 10:46:33 +08:00
parent f7384b9afc
commit 0f98c15cd4
11 changed files with 110 additions and 16 deletions

23
QRCodeService/Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /src
COPY ["QRCodeService/QRCodeService.csproj", "QRCodeService/"]
COPY ["Domain/Domain.csproj", "Domain/"]
COPY ["Infrastructure/Infrastructure.csproj", "Infrastructure/"]
RUN dotnet restore "QRCodeService/QRCodeService.csproj"
COPY . .
WORKDIR "/src/QRCodeService"
RUN dotnet build "QRCodeService.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "QRCodeService.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "QRCodeService.dll"]