Skip to content

Commit

Permalink
Hopefully fixed the Docker Image and enabled swagger in non dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
Hutch79 committed Jul 3, 2024
1 parent 0d8953a commit 855b583
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions API/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Your-Lab/Your-Lab.csproj", "Your-Lab/"]
RUN dotnet restore "Your-Lab/Your-Lab.csproj"
COPY ["API/API.csproj", "API/"]
RUN dotnet restore "API/API.csproj"
COPY . .
WORKDIR "/src/Your-Lab"
RUN dotnet build "Your-Lab.csproj" -c $BUILD_CONFIGURATION -o /app/build
WORKDIR "/src/API"
RUN dotnet build "API.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "Your-Lab.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
RUN dotnet publish "API.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Your-Lab.dll"]
ENTRYPOINT ["dotnet", "API.dll"]
6 changes: 3 additions & 3 deletions API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
// if (app.Environment.IsDevelopment())
// {
app.UseSwagger();
app.UseSwaggerUI();
}
// }

app.UseHttpsRedirection();

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
image: your-lab
build:
context: .
dockerfile: Your-Lab/Dockerfile
dockerfile: API/Dockerfile

0 comments on commit 855b583

Please sign in to comment.