Compare commits
No commits in common. "922b707b75d5963823db40b6ec9d07fa784d2a8f" and "8697a90fd971953645a7fa898955186a0371d259" have entirely different histories.
922b707b75
...
8697a90fd9
@ -89,34 +89,15 @@ 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 \
|
||||
--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
|
||||
|
||||
--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
|
||||
|
||||
# Limpa imagens não utilizadas
|
||||
docker image prune -f
|
||||
|
||||
|
||||
27
Dockerfile
27
Dockerfile
@ -1,4 +1,5 @@
|
||||
# Dockerfile otimizado para ARM64
|
||||
# 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.
|
||||
|
||||
FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
USER app
|
||||
WORKDIR /app
|
||||
@ -11,17 +12,13 @@ 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
|
||||
# Copiar código fonte depois do restore
|
||||
COPY . .
|
||||
WORKDIR "/src/OnlyOneAccessTemplate"
|
||||
|
||||
# Build otimizado
|
||||
RUN dotnet build "./OnlyOneAccessTemplate.csproj" \
|
||||
-c $BUILD_CONFIGURATION \
|
||||
-o /app/build \
|
||||
@ -30,30 +27,20 @@ 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:PublishReadyToRun=true \
|
||||
/p:PublishSingleFile=false
|
||||
/p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
# 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 (adicional - opcional mas recomendado)
|
||||
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 ["dotnet", "OnlyOneAccessTemplate.dll"]
|
||||
@ -15,7 +15,6 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="Views\En\" />
|
||||
<Folder Include="Views\Es\" />
|
||||
<Folder Include="wwwroot\img\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,56 +1,8 @@
|
||||
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();
|
||||
|
||||
@ -122,14 +74,7 @@ if (!app.Environment.IsDevelopment())
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
OnPrepareResponse = ctx =>
|
||||
{
|
||||
// Cache estático por 1 hora
|
||||
ctx.Context.Response.Headers.Append("Cache-Control", "public,max-age=3600");
|
||||
}
|
||||
});
|
||||
app.UseStaticFiles();
|
||||
|
||||
// Session
|
||||
app.UseSession();
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
},
|
||||
|
||||
"TextConversionApi": {
|
||||
"BaseUrl": "http://convert-it.online"
|
||||
"BaseUrl": "https://localhost:7071"
|
||||
},
|
||||
|
||||
"SEO": {
|
||||
|
||||
@ -22,11 +22,11 @@
|
||||
},
|
||||
|
||||
"MongoDB": {
|
||||
"DatabaseName": "text_case_converter_db-dev"
|
||||
"DatabaseName": "text_case_converter_db"
|
||||
},
|
||||
|
||||
"TextConversionApi": {
|
||||
"BaseUrl": "https://localhost:7299"
|
||||
"BaseUrl": "https://localhost:7071"
|
||||
},
|
||||
|
||||
"SEO": {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 MiB |
Loading…
Reference in New Issue
Block a user