Last active
December 22, 2020 18:35
-
-
Save ebicoglu/5637f7fb4b003604238c98f0da07aec1 to your computer and use it in GitHub Desktop.
Containerize Blazor with Docker + nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: "3.4" | |
services: | |
yourproject-migrator: | |
build: | |
context: . | |
dockerfile: src/YourProject.DbMigrator/Dockerfile | |
image: "${REGISTRY:-}yourproject-migrator:${TAG:-latest}" | |
yourproject-frontend: | |
build: | |
context: . | |
dockerfile: src/YourProject.Blazor/Dockerfile | |
image: "${REGISTRY:-}yourproject-frontend:${TAG:-latest}" | |
yourproject-backend: | |
build: | |
context: . | |
dockerfile: src/YourProject.HttpApi.Host/Dockerfile | |
image: "${REGISTRY:-}yourproject-backend:${TAG:-latest}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS builder | |
WORKDIR /app | |
COPY . . | |
RUN dotnet publish -c Release src/YourProject.Blazor -o /app/publish | |
FROM nginx:alpine | |
COPY --from=builder /app/publish/wwwroot /usr/share/nginx/html/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS builder | |
WORKDIR /app | |
COPY . . | |
RUN dotnet publish -c Release src/YourProject.DbMigrator -o /app/publish | |
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS runner | |
WORKDIR /app | |
COPY --from=builder /app/publish /app | |
EXPOSE 80 | |
CMD [ "dotnet", "YourProject.DbMigrator.dll"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS builder | |
WORKDIR /app | |
COPY . . | |
RUN dotnet publish -c Release src/YourProject.HttpApi.Host -o /app/publish | |
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS runner | |
WORKDIR /app | |
COPY --from=builder /app/publish /app | |
EXPOSE 80 | |
CMD [ "dotnet", "YourProject.HttpApi.Host.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment