Skip to content

Instantly share code, notes, and snippets.

@leandroribeiro
Last active March 5, 2024 09:30
Show Gist options
  • Save leandroribeiro/d24fbe43e01e89ab92bc23986ef449ef to your computer and use it in GitHub Desktop.
Save leandroribeiro/d24fbe43e01e89ab92bc23986ef449ef to your computer and use it in GitHub Desktop.
Docker Compose and Dockerfile to build and publish .NET Full Framework Sample WebAPI ASP.NET 4.8
version: '3.4'
services:
api.alpha:
image: api.alpha:latest
build:
context: .
dockerfile: API1/Dockerfile
api.omega:
image: api.omega:latest
build:
context: .
dockerfile: API2/Dockerfile
data:
image: microsoft/mssql-server-windows-developer
environment:
- SA_PASSWORD=Pass@word
- ACCEPT_EULA=Y
ports:
- "5433:1433"
# escape=`
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS builder
WORKDIR /app
COPY API1/. .
RUN nuget restore -PackagesDirectory ../packages
# RUN msbuild API1.csproj /p:OutputPath=c:\out `
# /t:restore
RUN msbuild API1.csproj /p:Configuration=Debug `
/p:DeployOnBuild=True `
/p:DeployDefaultTarget=WebPublish `
/p:WebPublishMethod=FileSystem `
/p:DeleteExistingFiles=True `
/p:publishUrl=c:\out
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
WORKDIR c:/inetpub/wwwroot
COPY --from=builder c:/out .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment