feat: Configure Docker to use host.docker.internal for database connection, include prisma.config.ts in the image, and simplify Prisma configuration.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
container_name: portfolio-db
|
||||
container_name: fikri-portfolio-db
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-fikri}
|
||||
@@ -21,12 +21,13 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: portfolio-app
|
||||
image: fikri-portfolio-app
|
||||
container_name: fikri-portfolio-app
|
||||
restart: always
|
||||
ports:
|
||||
- "4000:4000"
|
||||
environment:
|
||||
DATABASE_URL: postgresql://${POSTGRES_USER:-fikri}:${POSTGRES_PASSWORD:-fikri}@db:5432/${POSTGRES_DB:-fullstack-portfolio}?schema=public
|
||||
DATABASE_URL: postgresql://${POSTGRES_USER:-fikri}:${POSTGRES_PASSWORD:-fikri}@host.docker.internal:5429/${POSTGRES_DB:-fullstack-portfolio}?schema=public
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
R2_TOKEN: ${R2_TOKEN}
|
||||
R2_ACCESS_KEY: ${R2_ACCESS_KEY}
|
||||
@@ -37,6 +38,8 @@ services:
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
command: >
|
||||
sh -c "npx prisma migrate deploy && node server.js"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user