fix: dockerfile
All checks were successful
Deploy ASP.NET MVC to OCI / build-and-deploy (push) Successful in 11m16s

This commit is contained in:
Ricardo Carneiro 2025-06-03 21:37:00 -03:00
parent 922b707b75
commit 9734627786

View File

@ -1,4 +1,4 @@
# Dockerfile otimizado para ARM64
# Dockerfile self-contained para máxima performance
FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
@ -31,18 +31,17 @@ RUN dotnet build "./OnlyOneAccessTemplate.csproj" \
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
# Publish com AOT ReadyToRun para melhor performance
# Publish self-contained para eliminar cold start
RUN dotnet publish "./OnlyOneAccessTemplate.csproj" \
-c $BUILD_CONFIGURATION \
-o /app/publish \
--runtime linux-arm64 \
--no-restore \
--self-contained false \
/p:UseAppHost=false \
/p:PublishReadyToRun=true \
--self-contained true \
/p:PublishTrimmed=true \
/p:PublishSingleFile=false
FROM base AS final
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0 AS final
WORKDIR /app
COPY --from=publish /app/publish .
@ -52,8 +51,8 @@ ENV DOTNET_USE_POLLING_FILE_WATCHER=true
ENV ASPNETCORE_ENVIRONMENT=Production
ENV DOTNET_EnableDiagnostics=0
# Healthcheck simples (removendo rota específica)
# Healthcheck simples
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8080/ || exit 1
CMD curl -f http://localhost:8080/health || exit 1
ENTRYPOINT ["dotnet", "OnlyOneAccessTemplate.dll"]
ENTRYPOINT ["./OnlyOneAccessTemplate"]