fix: ajustes de versionamento
This commit is contained in:
parent
8697a90fd9
commit
e24143aed6
@ -89,13 +89,32 @@ jobs:
|
|||||||
docker pull registry.redecarneir.us/onlyoneaccesstemplate:latest
|
docker pull registry.redecarneir.us/onlyoneaccesstemplate:latest
|
||||||
|
|
||||||
# Executa o novo container na porta 80
|
# 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 \
|
docker run -d \
|
||||||
--name onlyoneaccesstemplate \
|
--name onlyoneaccesstemplate \
|
||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
-p 80:8080 \
|
-p 80:8080 \
|
||||||
-p 443:8081 \
|
-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_ENVIRONMENT=Production \
|
||||||
-e ASPNETCORE_URLS="http://+:8080;https://+:8081" \
|
-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
|
registry.redecarneir.us/onlyoneaccesstemplate:latest
|
||||||
|
|
||||||
# Limpa imagens não utilizadas
|
# Limpa imagens não utilizadas
|
||||||
|
|||||||
25
Dockerfile
25
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
|
FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
USER app
|
USER app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -12,13 +11,17 @@ WORKDIR /src
|
|||||||
|
|
||||||
# Copiar apenas arquivos de projeto primeiro (melhor cache)
|
# Copiar apenas arquivos de projeto primeiro (melhor cache)
|
||||||
COPY ["OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj", "OnlyOneAccessTemplate/"]
|
COPY ["OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj", "OnlyOneAccessTemplate/"]
|
||||||
|
|
||||||
|
# Restore com configurações otimizadas para ARM64
|
||||||
RUN dotnet restore "./OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj" \
|
RUN dotnet restore "./OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj" \
|
||||||
--runtime linux-arm64 \
|
--runtime linux-arm64 \
|
||||||
--no-cache
|
--no-cache
|
||||||
|
|
||||||
# Copiar código fonte depois do restore
|
# Copiar código fonte
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/OnlyOneAccessTemplate"
|
WORKDIR "/src/OnlyOneAccessTemplate"
|
||||||
|
|
||||||
|
# Build otimizado
|
||||||
RUN dotnet build "./OnlyOneAccessTemplate.csproj" \
|
RUN dotnet build "./OnlyOneAccessTemplate.csproj" \
|
||||||
-c $BUILD_CONFIGURATION \
|
-c $BUILD_CONFIGURATION \
|
||||||
-o /app/build \
|
-o /app/build \
|
||||||
@ -27,20 +30,30 @@ RUN dotnet build "./OnlyOneAccessTemplate.csproj" \
|
|||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
|
||||||
|
# Publish com AOT ReadyToRun para melhor performance
|
||||||
RUN dotnet publish "./OnlyOneAccessTemplate.csproj" \
|
RUN dotnet publish "./OnlyOneAccessTemplate.csproj" \
|
||||||
-c $BUILD_CONFIGURATION \
|
-c $BUILD_CONFIGURATION \
|
||||||
-o /app/publish \
|
-o /app/publish \
|
||||||
--runtime linux-arm64 \
|
--runtime linux-arm64 \
|
||||||
--no-restore \
|
--no-restore \
|
||||||
--self-contained false \
|
--self-contained false \
|
||||||
/p:UseAppHost=false
|
/p:UseAppHost=false \
|
||||||
|
/p:PublishReadyToRun=true \
|
||||||
|
/p:PublishSingleFile=false
|
||||||
|
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
|
|
||||||
# Healthcheck (adicional - opcional mas recomendado)
|
# 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
|
||||||
|
|
||||||
|
# Healthcheck simples (removendo rota específica)
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||||
CMD curl -f http://localhost:8080/health || exit 1
|
CMD curl -f http://localhost:8080/ || exit 1
|
||||||
|
|
||||||
ENTRYPOINT ["dotnet", "OnlyOneAccessTemplate.dll"]
|
ENTRYPOINT ["dotnet", "OnlyOneAccessTemplate.dll"]
|
||||||
@ -1,8 +1,56 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using OnlyOneAccessTemplate.Services;
|
using OnlyOneAccessTemplate.Services;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
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
|
// Add services to the container
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
|
|
||||||
@ -74,7 +122,14 @@ if (!app.Environment.IsDevelopment())
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
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
|
// Session
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"TextConversionApi": {
|
"TextConversionApi": {
|
||||||
"BaseUrl": "https://localhost:7071"
|
"BaseUrl": "http://convert-it.online"
|
||||||
},
|
},
|
||||||
|
|
||||||
"SEO": {
|
"SEO": {
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"TextConversionApi": {
|
"TextConversionApi": {
|
||||||
"BaseUrl": "https://localhost:7071"
|
"BaseUrl": "https://localhost:7299"
|
||||||
},
|
},
|
||||||
|
|
||||||
"SEO": {
|
"SEO": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user