From 722a394d03773f966836a96884ee9e99e26bd780 Mon Sep 17 00:00:00 2001 From: Serghei Cebotari Date: Sun, 14 Jan 2024 15:07:03 +0300 Subject: [PATCH] Docker files update --- .dockerignore | 1 - .../Deploy/Database => Database}/Dockerfile | 2 +- .../Database => Database}/init-database.sql | 0 Dockerfile | 1 - RhSolutions.Api/Deploy/docker-compose.yml | 27 --------------- docker-compose.yml | 34 +++++++++++++++++++ 6 files changed, 35 insertions(+), 30 deletions(-) delete mode 100644 .dockerignore rename {RhSolutions.Api/Deploy/Database => Database}/Dockerfile (85%) rename {RhSolutions.Api/Deploy/Database => Database}/init-database.sql (100%) delete mode 100644 RhSolutions.Api/Deploy/docker-compose.yml create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index a1670e1..0000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -[Dd]eploy/ \ No newline at end of file diff --git a/RhSolutions.Api/Deploy/Database/Dockerfile b/Database/Dockerfile similarity index 85% rename from RhSolutions.Api/Deploy/Database/Dockerfile rename to Database/Dockerfile index 5d76b63..a5b3787 100644 --- a/RhSolutions.Api/Deploy/Database/Dockerfile +++ b/Database/Dockerfile @@ -1,4 +1,4 @@ -FROM postgres:latest AS build +FROM postgres:16.1 AS build ADD ./init-database.sql /docker-entrypoint-initdb.d RUN chmod 644 /docker-entrypoint-initdb.d/init-database.sql EXPOSE 5432 diff --git a/RhSolutions.Api/Deploy/Database/init-database.sql b/Database/init-database.sql similarity index 100% rename from RhSolutions.Api/Deploy/Database/init-database.sql rename to Database/init-database.sql diff --git a/Dockerfile b/Dockerfile index db24e34..3b8aef5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,6 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY . ./ -RUN dotnet restore RUN dotnet publish -c Release -o out FROM mcr.microsoft.com/dotnet/aspnet:8.0 diff --git a/RhSolutions.Api/Deploy/docker-compose.yml b/RhSolutions.Api/Deploy/docker-compose.yml deleted file mode 100644 index 12759a8..0000000 --- a/RhSolutions.Api/Deploy/docker-compose.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: '3' - -services: - rhsolutions-api: - image: gitea.cebotari.ru/chebser/rhsolutions-api:latest - container_name: rhsolutions-api - ports: - - 5000:5000 - environment: - - DB_HOST=rhsolutions-db - - DB_PORT=5432 - - DB_DATABASE=rhsolutions - - DB_USER=chebser - - DB_PASSWORD=Rehau-987 - depends_on: - - rhsolutions-db - restart: unless-stopped - rhsolutions-db: - image: gitea.cebotari.ru/chebser/rhsolutions-db:latest - container_name: rhsolutions-db - ports: - - 5432:5432 - environment: - - POSTGRES_USER=chebser - - POSTGRES_PASSWORD=Rehau-987 - - POSTGRES_DB=rhsolutions - restart: unless-stopped \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1c01b58 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: '3' +services: + app: + build: . + container_name: app + ports: + - 5000:5000 + environment: + - DB_HOST=db + - DB_PORT=5432 + - DB_DATABASE=rhsolutions + - DB_USER=chebser + - DB_PASSWORD=Rehau-987 + networks: + - rhsolutions + volumes: + - ./RhSolutions.Api/MLModels:/app/MLModels + depends_on: + - db + db: + build: Database/. + container_name: db + environment: + - POSTGRES_USER=chebser + - POSTGRES_PASSWORD=Rehau-987 + - POSTGRES_DB=rhsolutions + volumes: + - db-data:/var/lib/postgresql/data + networks: + - rhsolutions +networks: + rhsolutions: +volumes: + db-data: \ No newline at end of file