summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-03-10 07:43:00 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-03-10 07:43:00 +0300
commit5eff87dd115966b9fe1b3981805300e26a8f94c2 (patch)
tree62a6080c47fa3b74dcaa0fd668fd317c8252b51e
parent389f98e1d3cf191f2862be7f67e94529143a0765 (diff)
Docker changes
-rw-r--r--.dockerignore14
-rw-r--r--.gitignore1
-rw-r--r--Dockerfile5
-rw-r--r--docker-compose.yml12
4 files changed, 26 insertions, 6 deletions
diff --git a/.dockerignore b/.dockerignore
index 858d1b3..0aed759 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,2 +1,12 @@
-# database file
-Database/* \ No newline at end of file
+# directories
+**/bin/
+**/obj/
+**/out/
+
+# files
+Dockerfile*
+**/*.trx
+**/*.md
+**/*.ps1
+**/*.cmd
+**/*.sh \ No newline at end of file
diff --git a/.gitignore b/.gitignore
index e767ca3..71a4a18 100644
--- a/.gitignore
+++ b/.gitignore
@@ -457,6 +457,7 @@ $RECYCLE.BIN/
wwwroot/lib/*
# image content
+wwwroot/Content/*
wwwroot/content/*
# database files
diff --git a/Dockerfile b/Dockerfile
index a2622e2..183e8d9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,12 +5,15 @@ COPY . ./
RUN dotnet restore
RUN dotnet tool restore
RUN dotnet libman restore
-RUN dotnet ef database update
+RUN dotnet ef database update --context DataContext
+RUN dotnet ef database update --context IdentityContext
+
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:6.0
EXPOSE 5000
WORKDIR /app
COPY --from=build /app/out .
+COPY --from=build /app/Database ./Database
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
index 250309e..1793945 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,9 +3,15 @@ version: '3'
services:
my-darling:
build: .
- container_name: mydarling-net
+ container_name: mydarling-dotnet
ports:
- "5050:5000"
volumes:
- - ./Database:/app/Database
- - ./wwwroot/content:/app/wwwroot/content \ No newline at end of file
+ - db:/app/Database
+ - content:/app/wwwroot/content
+ environment:
+ - ADMIN_PASSWORD=He110World!
+
+volumes:
+ db:
+ content: \ No newline at end of file