Skip to content

Commit

Permalink
Merge pull request #49 from peris-studio/feat/refactor-api-modelo-de-…
Browse files Browse the repository at this point in the history
…container-docker-46

[refactor]: adição do modelo de container.
  • Loading branch information
Hisllaylla authored Aug 7, 2024
2 parents 6d3e863 + 2138251 commit 25fa735
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/LojaDoValdir/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
# Etapa base do runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 8080

USER app
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG configuration=Release
WORKDIR /src
COPY ["src/LojaDoValdir/LojaDoValdir.csproj", "src/LojaDoValdir/"]
RUN dotnet restore "src/LojaDoValdir/LojaDoValdir.csproj"
# Etapa de build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /source
COPY ["LojaDoValdir.csproj", "."]
RUN dotnet restore "LojaDoValdir.csproj"
COPY . .
WORKDIR "/src/src/LojaDoValdir"
RUN dotnet build "LojaDoValdir.csproj" -c $configuration -o /app/build
WORKDIR "/source"
RUN dotnet build "LojaDoValdir.csproj" -c Release -o /app/build

# Etapa de publicação
FROM build AS publish
ARG configuration=Release
RUN dotnet publish "LojaDoValdir.csproj" -c $configuration -o /app/publish /p:UseAppHost=false
RUN dotnet publish "LojaDoValdir.csproj" -c Release -o /app/publish /p:UseAppHost=false

# Etapa final
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "LojaDoValdir.dll"]
ENTRYPOINT ["dotnet", "LojaDoValdir.dll"]

0 comments on commit 25fa735

Please sign in to comment.