FROM node:latest
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
COPY ./dist ./dist
CMD ["npm", "run", "dev"]
services:
main:
container_name: main
build:
context: .
env_file:
- .env
volumes:
- .:/app
- /app/node_modules
ports:
- 5000:5000
- 9229:9229
command: npm run dev
depends_on:
- postgres
restart: always
postgres:
container_name: postgres
image: postgres:12
env_file:
- .env
environment:
PG_DATA: /var/lib/postgresql/data
ports:
- 5432:5432
volumes:
- pgdata:/var/lib/postgresql/data
restart: always
volumes:
pgdata:
DATABASE_URL="postgresql://postgres:postgres@postgres:5432/mailru-clone?schema=public"
docker-compose build
docker-compose up
postgres | 2024-11-30 07:47:00.321 UTC [34] FATAL: database "mailru-clone" does not exist
main | /app/prisma/generated/client/runtime/library.js:112
main | PrismaClientInitializationError: Database `mailru-clone` does not exist on the database server at `postgres:5432`.
DATABASE_URL="postgresql://postgres:postgres@postgres:5432/mailru-clone?schema=public"
main | PrismaClientInitializationError: Database `mailru-clone` does not exist on the database server at `postgres:5432`.
main | at t (/app/prisma/generated/client/runtime/library.js:112:2488)
main | at async Proxy.onModuleInit (/app/src/prisma.service.ts:8:5)