Skip to content

Commit

Permalink
Changing DockerFile again
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiollende committed Mar 13, 2024
1 parent 70cd740 commit 9760dc8
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions wikidata_service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# Use the official image as a parent image.
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["WikiDataTest/WikiDataTest.csproj", "WikiDataTest/"]
RUN dotnet restore "./WikiDataTest/./WikiDataTest.csproj"
COPY . .
WORKDIR "/src/WikiDataTest"
RUN dotnet build "./WikiDataTest.csproj" -c %BUILD_CONFIGURATION% -o /app/build

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./WikiDataTest.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
FROM base AS final
WORKDIR /app
COPY --from=build-env /app/out .
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WikiDataTest.dll"]

0 comments on commit 9760dc8

Please sign in to comment.