Skip to content

Commit

Permalink
fix: api dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
zengande committed Apr 30, 2024
1 parent 3979dae commit 2c26e8c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>BeniceSoft.OpenAuthing</RootNamespace>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
Expand All @@ -25,5 +26,11 @@
<ProjectReference Include="..\BeniceSoft.OpenAuthing.RemoteService.Implements\BeniceSoft.OpenAuthing.RemoteService.Implements.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="..\..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>


</Project>
30 changes: 30 additions & 0 deletions src/BeniceSoft.OpenAuthing.AdminApi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["src/BeniceSoft.OpenAuthing.AdminApi/BeniceSoft.OpenAuthing.AdminApi.csproj", "src/BeniceSoft.OpenAuthing.AdminApi/"]
COPY ["src/BeniceSoft.OpenAuthing.Application/BeniceSoft.OpenAuthing.Application.csproj", "src/BeniceSoft.OpenAuthing.Application/"]
COPY ["src/BeniceSoft.OpenAuthing.Application.Contracts/BeniceSoft.OpenAuthing.Application.Contracts.csproj", "src/BeniceSoft.OpenAuthing.Application.Contracts/"]
COPY ["src/BeniceSoft.OpenAuthing.Domain.Shared/BeniceSoft.OpenAuthing.Domain.Shared.csproj", "src/BeniceSoft.OpenAuthing.Domain.Shared/"]
COPY ["src/BeniceSoft.OpenAuthing.Domain/BeniceSoft.OpenAuthing.Domain.csproj", "src/BeniceSoft.OpenAuthing.Domain/"]
COPY ["src/BeniceSoft.OpenAuthing.EntityFrameworkCore/BeniceSoft.OpenAuthing.EntityFrameworkCore.csproj", "src/BeniceSoft.OpenAuthing.EntityFrameworkCore/"]
COPY ["src/BeniceSoft.OpenAuthing.RemoteService.Implements/BeniceSoft.OpenAuthing.RemoteService.Implements.csproj", "src/BeniceSoft.OpenAuthing.RemoteService.Implements/"]
COPY ["src/BeniceSoft.OpenAuthing.RemoteService.Abstractions/BeniceSoft.OpenAuthing.RemoteService.Abstractions.csproj", "src/BeniceSoft.OpenAuthing.RemoteService.Abstractions/"]
RUN dotnet restore "src/BeniceSoft.OpenAuthing.AdminApi/BeniceSoft.OpenAuthing.AdminApi.csproj"
COPY . .
WORKDIR "/src/src/BeniceSoft.OpenAuthing.AdminApi"
RUN dotnet build "BeniceSoft.OpenAuthing.AdminApi.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "BeniceSoft.OpenAuthing.AdminApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "BeniceSoft.OpenAuthing.AdminApi.dll"]

0 comments on commit 2c26e8c

Please sign in to comment.