Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit dcfd4c7

Browse files
authored
feat: docker setup for local development (#29)
* feat: docker for development * docs: docker documentation * fix: update credentials for db
1 parent 93f29f7 commit dcfd4c7

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
55
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
66

7-
DATABASE_URL="postgresql://localhost:5432/trending?schema=public"
7+
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/trending?schema=public"
88
API_TOOL_KIT_TOKEN=""

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,14 @@ GET `/daily?date=2024-09-13`
164164
## Requirements
165165

166166
- nodejs
167-
- postgres
167+
- postgres (can be run in Docker)
168+
169+
## Running Postgres in Docker (optional)
170+
To run postgres in docker, run the following command:
171+
172+
```bash
173+
npm run docker
174+
```
168175

169176
## Project setup
170177

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "3"
2+
services:
3+
db:
4+
image: postgres:latest # You can specify a version, e.g., postgres:13
5+
restart: always
6+
ports:
7+
- "5432:5432"
8+
environment:
9+
POSTGRES_USER: postgres
10+
POSTGRES_PASSWORD: postgres
11+
POSTGRES_DB: db

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
2020
"test:e2e": "jest --config ./test/jest-e2e.json",
2121
"db:migrate:dev": "prisma migrate dev",
22-
"db:migrate:prod": "prisma migrate deploy"
22+
"db:migrate:prod": "prisma migrate deploy",
23+
"docker": "docker compose up -d"
2324
},
2425
"dependencies": {
2526
"@nestjs/common": "^10.0.0",

0 commit comments

Comments
 (0)