feat(auth): add Dockerfile for containerization

This commit is contained in:
Sam 2026-02-02 09:55:10 +08:00
parent 58e6969e95
commit a7d87a98b7
2 changed files with 24 additions and 0 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
bin/
obj/
Dockerfile
.dockerignore
*.md

19
Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY ["Fengling.AuthService.csproj", "./"]
RUN dotnet restore "Fengling.AuthService.csproj"
COPY . .
WORKDIR "/src"
RUN dotnet build "Fengling.AuthService.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Fengling.AuthService.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Fengling.AuthService.dll"]