From 1d6f4faf7e1b7783acc7b0ca659a91935945183a Mon Sep 17 00:00:00 2001 From: i701 Date: Mon, 16 Dec 2024 21:39:03 +0500 Subject: [PATCH] Refactor Docker setup and add Prisma Studio service - Introduced a new prisma-studio service in compose.yml for easier database management. - Added a PostgreSQL database service with environment variables for user and database setup. - Removed the outdated node service configuration from .build/dev/compose.yml. - Simplified the node Dockerfile by removing unnecessary shell configuration. - Created a new prisma.Dockerfile for running Prisma Studio. These changes enhance the development environment and streamline database interactions. --- .build/dev/compose.yml | 7 ------- .build/dev/node.Dockerfile | 2 -- .build/dev/prisma.Dockerfile | 5 +++++ compose.yml | 22 ++++++++++++++++++++++ 4 files changed, 27 insertions(+), 9 deletions(-) delete mode 100644 .build/dev/compose.yml create mode 100644 .build/dev/prisma.Dockerfile diff --git a/.build/dev/compose.yml b/.build/dev/compose.yml deleted file mode 100644 index ecd0328..0000000 --- a/.build/dev/compose.yml +++ /dev/null @@ -1,7 +0,0 @@ -services: - node: - build: - context: ../../ - dockerfile: .build/dev/node.Dockerfile - hostname: sarlink-portal - image: git.shihaam.dev/sarlink/sarlink-portal diff --git a/.build/dev/node.Dockerfile b/.build/dev/node.Dockerfile index 32beb94..592e1fb 100644 --- a/.build/dev/node.Dockerfile +++ b/.build/dev/node.Dockerfile @@ -1,7 +1,5 @@ FROM node:18 -SHELL ["/bin/bash", "-c"] - WORKDIR /var/www/html CMD npm run dev diff --git a/.build/dev/prisma.Dockerfile b/.build/dev/prisma.Dockerfile new file mode 100644 index 0000000..eb2d720 --- /dev/null +++ b/.build/dev/prisma.Dockerfile @@ -0,0 +1,5 @@ +FROM node:18 + +WORKDIR /var/www/html + +CMD npx prisma studio diff --git a/compose.yml b/compose.yml index d63d7fc..0757c7d 100644 --- a/compose.yml +++ b/compose.yml @@ -8,3 +8,25 @@ services: - ./:/var/www/html/ ports: - 3000:3000 + prisma-studio: + build: + context: .build/dev + dockerfile: prisma.Dockerfile + hostname: sarlink-portal-studio + volumes: + - ./:/var/www/html/ + ports: + - 5555:5555 + database: + image: postgres:14 + hostname: sarlink-portal-db + volumes: + - db-data:/var/lib/postgresql/data + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: testpass123 + POSTGRES_DB: mydb + + +volumes: + db-data: