Skip to content

Commit

Permalink
feat: Updated Dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-meier committed Sep 15, 2023
1 parent 70da21b commit b9f381c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.user
*.userosscache
*.sln.docstates
.idea
data/map_data.mbtiles
tools

Expand Down
22 changes: 10 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
# prepare hosting image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS hosting
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM base AS basetools
# prepare ops tooling
FROM hosting AS hosting-tools
RUN apt update && apt install -y curl && mkdir /tools && \
curl -L https://aka.ms/dotnet-counters/linux-x64 -o /tools/dotnet-counters && \
curl -L https://aka.ms/dotnet-dump/linux-x64 -o /tools/dotnet-dump && \
chmod +x /tools/dotnet-counters /tools/dotnet-dump

# build the application
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["src/tile-server.csproj", "./"]
RUN dotnet restore "tile-server.csproj"
COPY ./src .
WORKDIR "/src/"
RUN dotnet build "tile-server.csproj" -c Release -o /app/build
COPY src/. .
RUN dotnet publish -c release -o /app/publish

FROM build AS publish
RUN dotnet publish "tile-server.csproj" -c Release -o /app/publish

FROM basetools AS final
# final stage/image
FROM hosting-tools AS server
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "tile-server.dll"]

0 comments on commit b9f381c

Please sign in to comment.