first pass
This commit is contained in:
34
templates/dotnet/blazor/.dockerignore.template
Normal file
34
templates/dotnet/blazor/.dockerignore.template
Normal file
@@ -0,0 +1,34 @@
|
||||
bin
|
||||
obj
|
||||
.git
|
||||
.gitignore
|
||||
.env
|
||||
.env.local
|
||||
*.tar
|
||||
*.tar.gz
|
||||
|
||||
# IDE
|
||||
.vs
|
||||
.vscode
|
||||
.idea
|
||||
*.user
|
||||
*.suo
|
||||
|
||||
# Build
|
||||
publish
|
||||
|
||||
# Documentation
|
||||
README.md
|
||||
README.DOCKER.md
|
||||
docs
|
||||
|
||||
# Docker files
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
.dockerignore
|
||||
docker-deployment.json
|
||||
*.ps1
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
logs
|
||||
28
templates/dotnet/blazor/Dockerfile.template
Normal file
28
templates/dotnet/blazor/Dockerfile.template
Normal file
@@ -0,0 +1,28 @@
|
||||
# Stage 1: Build
|
||||
FROM mcr.microsoft.com/dotnet/sdk:{{DOTNET_VERSION}} AS build
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# Copy project file and restore
|
||||
COPY ["{{CSPROJ_FILE}}", "./"]
|
||||
RUN dotnet restore "{{CSPROJ_FILE}}"
|
||||
|
||||
# Copy everything else and build
|
||||
COPY . .
|
||||
RUN dotnet build "{{CSPROJ_FILE}}" -c Release -o /app/build
|
||||
RUN dotnet publish "{{CSPROJ_FILE}}" -c Release -o /app/publish
|
||||
|
||||
# Stage 2: Runtime
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:{{DOTNET_VERSION}}
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
# Set environment
|
||||
ENV ASPNETCORE_URLS=http://+:{{PORT}}
|
||||
ENV ASPNETCORE_ENVIRONMENT=Production
|
||||
|
||||
EXPOSE {{PORT}}
|
||||
|
||||
ENTRYPOINT ["dotnet", "{{DLL_NAME}}"]
|
||||
20
templates/dotnet/blazor/docker-compose.yml.template
Normal file
20
templates/dotnet/blazor/docker-compose.yml.template
Normal file
@@ -0,0 +1,20 @@
|
||||
services:
|
||||
{{PROJECT_NAME}}:
|
||||
build: .
|
||||
container_name: {{PROJECT_NAME}}
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${HOST_PORT:-{{PORT}}}:{{PORT}}"
|
||||
{{#if USE_ENV_FILE}}
|
||||
env_file:
|
||||
- .env
|
||||
{{/if}}
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
ASPNETCORE_URLS: http://+:{{PORT}}
|
||||
{{#if HAS_VOLUMES}}
|
||||
volumes:
|
||||
{{#each VOLUMES}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
Reference in New Issue
Block a user