summaryrefslogtreecommitdiff
path: root/RhSolutions.Deploy
diff options
context:
space:
mode:
Diffstat (limited to 'RhSolutions.Deploy')
-rw-r--r--RhSolutions.Deploy/database/Dockerfile6
-rw-r--r--RhSolutions.Deploy/database/init-database.sql25
-rw-r--r--RhSolutions.Deploy/docker-compose.yml31
3 files changed, 62 insertions, 0 deletions
diff --git a/RhSolutions.Deploy/database/Dockerfile b/RhSolutions.Deploy/database/Dockerfile
new file mode 100644
index 0000000..5d76b63
--- /dev/null
+++ b/RhSolutions.Deploy/database/Dockerfile
@@ -0,0 +1,6 @@
+FROM postgres:latest AS build
+ADD ./init-database.sql /docker-entrypoint-initdb.d
+RUN chmod 644 /docker-entrypoint-initdb.d/init-database.sql
+EXPOSE 5432
+ENTRYPOINT [ "docker-entrypoint.sh" ]
+CMD [ "postgres" ] \ No newline at end of file
diff --git a/RhSolutions.Deploy/database/init-database.sql b/RhSolutions.Deploy/database/init-database.sql
new file mode 100644
index 0000000..ec6ac7d
--- /dev/null
+++ b/RhSolutions.Deploy/database/init-database.sql
@@ -0,0 +1,25 @@
+CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" (
+ "MigrationId" character varying(150) NOT NULL,
+ "ProductVersion" character varying(32) NOT NULL,
+ CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId")
+);
+
+START TRANSACTION;
+
+CREATE TABLE "Products" (
+ "Id" integer GENERATED BY DEFAULT AS IDENTITY,
+ "ProductSku" text NULL,
+ "DeprecatedSkus" text[] NOT NULL,
+ "Name" text NOT NULL,
+ "ProductLine" text NULL,
+ "IsOnWarehouse" boolean NULL,
+ "ProductMeasure" integer NOT NULL,
+ "DeliveryMakeUp" double precision NULL,
+ "Price" numeric(8,2) NOT NULL,
+ CONSTRAINT "PK_Products" PRIMARY KEY ("Id")
+);
+
+INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
+VALUES ('20221201071323_Init', '7.0.0');
+
+COMMIT; \ No newline at end of file
diff --git a/RhSolutions.Deploy/docker-compose.yml b/RhSolutions.Deploy/docker-compose.yml
new file mode 100644
index 0000000..b5f4ebc
--- /dev/null
+++ b/RhSolutions.Deploy/docker-compose.yml
@@ -0,0 +1,31 @@
+version: '3'
+
+services:
+
+ rhsolutions-api:
+ build: ../RhSolutions.Api
+ 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:
+ container_name: rhsolutions-db
+ build: ./database
+ environment:
+ - POSTGRES_USER=chebser
+ - POSTGRES_PASSWORD=Rehau-987
+ - POSTGRES_DB=rhsolutions
+ restart: unless-stopped
+
+networks:
+ default:
+ name: rhsolutions \ No newline at end of file