0
0

Add docker support

This commit is contained in:
Sergey Chebotar 2023-02-02 08:17:17 +03:00
parent 591bf9056b
commit 3f54d070e7
4 changed files with 46 additions and 0 deletions

12
.config/dotnet-tools.json Normal file
View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "7.0.2",
"commands": [
"dotnet-ef"
]
}
}
}

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
# database file
Database/MyDarlingDb.db
Database/MyDarlingDb.db-shm
Database/MyDarlingDb.db-wal

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app
COPY . ./
RUN dotnet restore
RUN dotnet tool restore
RUN dotnet ef database update
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:6.0
EXPOSE 5000
WORKDIR /app
COPY --from=build /app/out .
ENV ASPNETCORE_ENVIRONMENT Production
ENTRYPOINT [ "dotnet", "MyDarling.dll", "--urls=http://0.0.0.0:5000" ]

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
version: '3'
services:
my-darling:
build: .
container_name: mydarling-net
ports:
- "5050:5000"
volumes:
- mydarling-db:/app/Database
- mydarling-wwwroot:/app/wwwroot
volumes:
mydarling-db:
mydarling-wwwroot: