Add Docker support for the Monolith backend
This commit is contained in:
Родитель
1d4f8400d8
Коммит
ea0cc7c8a9
|
@ -0,0 +1,10 @@
|
|||
.dockerignore
|
||||
.env
|
||||
.git
|
||||
.gitignore
|
||||
.vs
|
||||
.vscode
|
||||
docker-compose.yml
|
||||
docker-compose.*.yml
|
||||
*/bin
|
||||
*/obj
|
|
@ -0,0 +1,37 @@
|
|||
#######################################################
|
||||
# Step 1: Build the application in a container #
|
||||
#######################################################
|
||||
|
||||
# Download the official ASP.NET Core SDK image
|
||||
# to build the project while creating the docker image
|
||||
FROM microsoft/dotnet:2.1-sdk-alpine as build
|
||||
WORKDIR /app
|
||||
|
||||
# Restore NuGet packages
|
||||
COPY *.csproj .
|
||||
RUN dotnet restore
|
||||
|
||||
# Copy the rest of the files over
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN dotnet publish --output /out/ --configuration Release
|
||||
|
||||
#######################################################
|
||||
# Step 2: Run the build outcome in a container #
|
||||
#######################################################
|
||||
|
||||
# Download the official ASP.NET Core Runtime image
|
||||
# to run the compiled application
|
||||
FROM microsoft/dotnet:2.1.3-aspnetcore-runtime-alpine
|
||||
WORKDIR /app
|
||||
|
||||
# Open HTTP and HTTPS ports
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
# Copy the build output from the SDK image
|
||||
COPY --from=build /out .
|
||||
|
||||
# Start the application
|
||||
ENTRYPOINT ["dotnet", "ContosoMaintenance.WebAPI.dll"]
|
Загрузка…
Ссылка в новой задаче