Updated docker file to build and package the application and allowed Swagger page to be accessible in production mode
continuous-integration/drone/push Build is failing Details

pull/1/head
Xander Sigler 2 years ago
parent 7f61374793
commit a2a046aa71

@ -0,0 +1,27 @@
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY . ./
RUN dotnet restore
#COPY ["/src/AdventOfCode/AdventOfCode.csproj", "AdventOfCode/"]
RUN dotnet restore "AdventOfCode.csproj"
#COPY ["AdventOfCode/", "AdventOfCode/."]
RUN dotnet build "AdventOfCode.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "./AdventOfCode.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
ENV ASPNETCORE_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=http://+:80
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "AdventOfCode.dll"]

@ -51,9 +51,10 @@ namespace AdventOfCode
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
}
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AdventOfCode v1")); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AdventOfCode v1"));
}
app.UseHttpsRedirection(); app.UseHttpsRedirection();

Loading…
Cancel
Save