summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-02-02 08:17:17 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-02-02 08:17:17 +0300
commit3f54d070e72955db80f410ba74a73846df1fbe09 (patch)
treee152549eb2a4256e8155970fef759ced65138967
parent591bf9056b86e0a4a94e8761d011a885c4b0b34c (diff)
Add docker support
-rw-r--r--.config/dotnet-tools.json12
-rw-r--r--.dockerignore4
-rw-r--r--Dockerfile15
-rw-r--r--docker-compose.yml15
4 files changed, 46 insertions, 0 deletions
diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
new file mode 100644
index 0000000..f331fe5
--- /dev/null
+++ b/.config/dotnet-tools.json
@@ -0,0 +1,12 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "dotnet-ef": {
+ "version": "7.0.2",
+ "commands": [
+ "dotnet-ef"
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..f11c5d6
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+# database file
+Database/MyDarlingDb.db
+Database/MyDarlingDb.db-shm
+Database/MyDarlingDb.db-wal \ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..10afed7
--- /dev/null
+++ b/Dockerfile
@@ -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" ] \ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..a683f15
--- /dev/null
+++ b/docker-compose.yml
@@ -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: \ No newline at end of file