Updated docker file to build and package the application and allowed Swagger page to be accessible in production mode
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
7f61374793
commit
a2a046aa71
27
AdventOfCode/Dockerfile
Normal file
27
AdventOfCode/Dockerfile
Normal file
@ -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,10 +51,11 @@ namespace AdventOfCode
|
|||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
app.UseSwagger();
|
|
||||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AdventOfCode v1"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.UseSwagger();
|
||||||
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AdventOfCode v1"));
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user