Skip to content

update Dockerfile #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions samples/AdvancedChatRoom/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src/AdvancedChatRoom
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src/
COPY ./. ./
RUN dotnet restore && dotnet build
ENTRYPOINT ["bash", "-c", "dotnet run --urls http://0.0.0.0:80"]
RUN dotnet restore "AdvancedChatRoom.csproj"
RUN dotnet build "AdvancedChatRoom.csproj" -c Release -o /app/build

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

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "AdvancedChatRoom.dll", "--urls", "http://0.0.0.0:80"]
19 changes: 15 additions & 4 deletions samples/ChatRoom/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src/ChatRoom
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src/
COPY ./. ./
RUN dotnet restore && dotnet build
ENTRYPOINT ["bash", "-c", "dotnet run --urls http://0.0.0.0:80"]
RUN dotnet restore "ChatRoom.csproj"
RUN dotnet build "ChatRoom.csproj" -c Release -o /app/build

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

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ChatRoom.dll", "--urls", "http://0.0.0.0:80"]
19 changes: 15 additions & 4 deletions samples/ChatRoomLocal/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src/ChatRoomLocal
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src/
COPY ./. ./
RUN dotnet restore && dotnet build
ENTRYPOINT ["bash", "-c", "dotnet run --urls http://0.0.0.0:80"]
RUN dotnet restore "ChatRoomLocal.csproj"
RUN dotnet build "ChatRoomLocal.csproj" -c Release -o /app/build

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

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ChatRoomLocal.dll", "--urls", "http://0.0.0.0:80"]
18 changes: 14 additions & 4 deletions samples/GitHubChat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src/GitHubChat
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src/
COPY ./. ./
RUN dotnet restore && dotnet build
RUN dotnet restore "GitHubChat.csproj"
RUN dotnet build "GitHubChat.csproj" -c Release -o /app/build

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

ENTRYPOINT ["bash","-c", "dotnet run --GitHubClientId $GITHUB_CLIENT_ID --GitHubClientSecret $GITHUB_CLIENT_SECRET --urls http://0.0.0.0:80"]
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT dotnet GitHubChat.dll --urls http://0.0.0.0:80 --GitHubClientId $GITHUB_CLIENT_ID --GitHubClientSecret $GITHUB_CLIENT_SECRET