From a62dda43564295e163ff6a39edb1a0a194aa5ecc Mon Sep 17 00:00:00 2001 From: pjsier Date: Tue, 21 May 2024 21:15:24 -0400 Subject: [PATCH] refactor: clean up docker compose --- docker-compose.override.yml | 27 --------------------------- docker-compose.yml | 28 ++++++++++++++++++++++++++-- server/db/index.js | 2 +- 3 files changed, 27 insertions(+), 30 deletions(-) delete mode 100644 docker-compose.override.yml diff --git a/docker-compose.override.yml b/docker-compose.override.yml deleted file mode 100644 index 9f38405..0000000 --- a/docker-compose.override.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: "3" -services: - api: - build: - context: ./server/ - dockerfile: Dockerfile.dev - depends_on: - - postgres - env_file: ./envs/api.env - ports: - - "5000:5000" - volumes: - - ./server/:/app/ - - /app/node_modules - client: - build: - context: ./client/ - dockerfile: Dockerfile.dev - depends_on: - - api - env_file: ./envs/client.env - ports: - - "5173:5173" - volumes: - - ./client/:/app/ - - /app/node_modules - stdin_open: true diff --git a/docker-compose.yml b/docker-compose.yml index a088711..ff368ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,33 @@ -version: "3" services: postgres: - image: mdillon/postgis:11 #this may affect drivers for rstudio! + image: mdillon/postgis:11 ports: - "35432:5432" env_file: ./envs/db.env volumes: - ./pg/data:/var/lib/postgresql/data + api: + build: + context: ./server/ + dockerfile: Dockerfile.dev + depends_on: + - postgres + env_file: ./envs/api.env + ports: + - "5000:5000" + volumes: + - ./server/:/app/ + - /app/node_modules + client: + build: + context: ./client/ + dockerfile: Dockerfile.dev + depends_on: + - api + env_file: ./envs/client.env + ports: + - "5173:5173" + volumes: + - ./client/:/app/ + - /app/node_modules + stdin_open: true diff --git a/server/db/index.js b/server/db/index.js index 1d78d7a..5abd505 100644 --- a/server/db/index.js +++ b/server/db/index.js @@ -3,7 +3,7 @@ const { Pool } = require("pg") //DB Connection const CONNECTION_STRING = process.env.DATABASE_URL || - `postgresql://${process.env.DATABASE_USERNAME}:${process.env.DATABASE_PASSWORD}@${process.env.DATABASE_HOST}/${process.env.DATABASE_NAME}` + `postgresql://${process.env.DATABASE_USERNAME}:${process.env.DATABASE_PASSWORD}@${process.env.DATABASE_HOST}:${process.env.DATABASE_PORT}/${process.env.DATABASE_NAME}` const pool = new Pool({ connectionString: CONNECTION_STRING,