fix: ajustes de versionamento
This commit is contained in:
parent
8697a90fd9
commit
e24143aed6
@ -89,15 +89,34 @@ jobs:
|
||||
docker pull registry.redecarneir.us/onlyoneaccesstemplate:latest
|
||||
|
||||
# Executa o novo container na porta 80
|
||||
# docker run -d \
|
||||
# --name onlyoneaccesstemplate \
|
||||
# --restart unless-stopped \
|
||||
# -p 80:8080 \
|
||||
# -p 443:8081 \
|
||||
# -e ASPNETCORE_ENVIRONMENT=Production \
|
||||
# -e ASPNETCORE_URLS="http://+:8080;https://+:8081" \
|
||||
# registry.redecarneir.us/onlyoneaccesstemplate:latest
|
||||
docker run -d \
|
||||
--name onlyoneaccesstemplate \
|
||||
--restart unless-stopped \
|
||||
-p 80:8080 \
|
||||
-p 443:8081 \
|
||||
-e ASPNETCORE_ENVIRONMENT=Production \
|
||||
-e ASPNETCORE_URLS="http://+:8080;https://+:8081" \
|
||||
registry.redecarneir.us/onlyoneaccesstemplate:latest
|
||||
|
||||
--name onlyoneaccesstemplate \
|
||||
--restart unless-stopped \
|
||||
-p 80:8080 \
|
||||
-p 443:8081 \
|
||||
--memory=2g \
|
||||
--cpus=1.5 \
|
||||
--health-cmd="curl -f http://localhost:8080/health || exit 1" \
|
||||
--health-interval=30s \
|
||||
--health-timeout=10s \
|
||||
--health-retries=3 \
|
||||
--health-start-period=60s \
|
||||
-e ASPNETCORE_ENVIRONMENT=Production \
|
||||
-e ASPNETCORE_URLS="http://+:8080;https://+:8081" \
|
||||
-e DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true \
|
||||
-e DOTNET_USE_POLLING_FILE_WATCHER=true \
|
||||
-e DOTNET_EnableDiagnostics=0 \
|
||||
-e DOTNET_RUNNING_IN_CONTAINER=true \
|
||||
registry.redecarneir.us/onlyoneaccesstemplate:latest
|
||||
|
||||
# Limpa imagens não utilizadas
|
||||
docker image prune -f
|
||||
|
||||
|
||||
29
Dockerfile
29
Dockerfile
@ -1,5 +1,4 @@
|
||||
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
# Dockerfile otimizado para ARM64
|
||||
FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
USER app
|
||||
WORKDIR /app
|
||||
@ -12,13 +11,17 @@ WORKDIR /src
|
||||
|
||||
# Copiar apenas arquivos de projeto primeiro (melhor cache)
|
||||
COPY ["OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj", "OnlyOneAccessTemplate/"]
|
||||
|
||||
# Restore com configurações otimizadas para ARM64
|
||||
RUN dotnet restore "./OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj" \
|
||||
--runtime linux-arm64 \
|
||||
--no-cache
|
||||
|
||||
# Copiar código fonte depois do restore
|
||||
# Copiar código fonte
|
||||
COPY . .
|
||||
WORKDIR "/src/OnlyOneAccessTemplate"
|
||||
|
||||
# Build otimizado
|
||||
RUN dotnet build "./OnlyOneAccessTemplate.csproj" \
|
||||
-c $BUILD_CONFIGURATION \
|
||||
-o /app/build \
|
||||
@ -27,20 +30,30 @@ RUN dotnet build "./OnlyOneAccessTemplate.csproj" \
|
||||
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
|
||||
# Publish com AOT ReadyToRun para melhor performance
|
||||
RUN dotnet publish "./OnlyOneAccessTemplate.csproj" \
|
||||
-c $BUILD_CONFIGURATION \
|
||||
-o /app/publish \
|
||||
--runtime linux-arm64 \
|
||||
--no-restore \
|
||||
--self-contained false \
|
||||
/p:UseAppHost=false
|
||||
/p:UseAppHost=false \
|
||||
/p:PublishReadyToRun=true \
|
||||
/p:PublishSingleFile=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
# Healthcheck (adicional - opcional mas recomendado)
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/health || exit 1
|
||||
# Variáveis de ambiente otimizadas para produção
|
||||
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
|
||||
ENV DOTNET_USE_POLLING_FILE_WATCHER=true
|
||||
ENV ASPNETCORE_ENVIRONMENT=Production
|
||||
ENV DOTNET_EnableDiagnostics=0
|
||||
|
||||
ENTRYPOINT ["dotnet", "OnlyOneAccessTemplate.dll"]
|
||||
# Healthcheck simples (removendo rota específica)
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/ || exit 1
|
||||
|
||||
ENTRYPOINT ["dotnet", "OnlyOneAccessTemplate.dll"]
|
||||
|
||||
@ -1,8 +1,56 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using MongoDB.Driver;
|
||||
using OnlyOneAccessTemplate.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Configurações otimizadas para produção ARM64
|
||||
if (builder.Environment.IsProduction())
|
||||
{
|
||||
// Configurar Kestrel para melhor performance
|
||||
builder.WebHost.ConfigureKestrel(options =>
|
||||
{
|
||||
options.Limits.MaxConcurrentConnections = 100;
|
||||
options.Limits.MaxConcurrentUpgradedConnections = 100;
|
||||
options.Limits.MaxRequestBodySize = 10 * 1024 * 1024; // 10MB
|
||||
options.Limits.MinRequestBodyDataRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(10));
|
||||
options.Limits.MinResponseDataRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(10));
|
||||
options.AddServerHeader = false;
|
||||
});
|
||||
|
||||
// Configurações de logging otimizadas
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddConsole();
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Warning);
|
||||
}
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews(options =>
|
||||
{
|
||||
if (builder.Environment.IsProduction())
|
||||
{
|
||||
// Configurações de cache para produção
|
||||
options.CacheProfiles.Add("Default", new CacheProfile()
|
||||
{
|
||||
Duration = 300 // 5 minutos
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Configurar Response Caching
|
||||
builder.Services.AddResponseCaching(options =>
|
||||
{
|
||||
options.MaximumBodySize = 1024 * 1024; // 1MB
|
||||
options.UseCaseSensitivePaths = false;
|
||||
});
|
||||
|
||||
// Configurar Response Compression
|
||||
builder.Services.AddResponseCompression(options =>
|
||||
{
|
||||
options.EnableForHttps = true;
|
||||
});
|
||||
|
||||
// Add services to the container
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
@ -74,7 +122,14 @@ if (!app.Environment.IsDevelopment())
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
OnPrepareResponse = ctx =>
|
||||
{
|
||||
// Cache estático por 1 hora
|
||||
ctx.Context.Response.Headers.Append("Cache-Control", "public,max-age=3600");
|
||||
}
|
||||
});
|
||||
|
||||
// Session
|
||||
app.UseSession();
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
},
|
||||
|
||||
"TextConversionApi": {
|
||||
"BaseUrl": "https://localhost:7071"
|
||||
"BaseUrl": "http://convert-it.online"
|
||||
},
|
||||
|
||||
"SEO": {
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
},
|
||||
|
||||
"TextConversionApi": {
|
||||
"BaseUrl": "https://localhost:7071"
|
||||
"BaseUrl": "https://localhost:7299"
|
||||
},
|
||||
|
||||
"SEO": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user