diff --git a/.drone.yml b/.drone.yml index 821b839..40df283 100644 --- a/.drone.yml +++ b/.drone.yml @@ -82,10 +82,6 @@ type: docker name: deploy depends_on: - package -trigger: - event: - exclude: - - promote clone: disable: true diff --git a/Dockerfile b/Dockerfile index d5b26b3..d965267 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ -FROM mcr.microsoft.com/dotnet/aspnet:8.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final WORKDIR /app -COPY ./SampleApi/bin/Release/net8.0/publish/ . +USER app + +COPY --chown=app:app ./SampleApi/bin/Release/net8.0/publish/ . -ENV ASPNETCORE_HTTP_PORTS=8081 EXPOSE 8081 +ENV ASPNETCORE_HTTP_PORTS=8081 -WORKDIR /app ENTRYPOINT ["dotnet", "SampleApi.dll"] \ No newline at end of file diff --git a/SampleApi/Program.cs b/SampleApi/Program.cs index 48863a6..1ca2f88 100644 --- a/SampleApi/Program.cs +++ b/SampleApi/Program.cs @@ -1,25 +1,20 @@ var builder = WebApplication.CreateBuilder(args); -// Add services to the container. - builder.Services.AddControllers(); -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); -// Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } +app.UseRouting(); app.UseHttpsRedirection(); - app.UseAuthorization(); - app.MapControllers(); app.Run();