Skip to content

Commit

Permalink
chore: auto migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
HungLV46 committed Aug 1, 2024
1 parent 7f6c776 commit 81bb55c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ dist

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
.devcontainer

# yarn v2
.yarn/cache
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ WORKDIR /ip-scan-be
ADD . /ip-scan-be

# Command to run the application
CMD ["yarn", "start"]
ENTRYPOINT ["./entrypoint.sh"]
21 changes: 20 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,32 @@ services:
networks:
- local
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
retries: 5
start_period: 30s
timeout: 5s

redis:
image: redis:6.2.2
networks:
- local
ports:
- 6379:6379
- '6379:6379'

be:
image: ipscanbe
depends_on:
postgres:
condition: service_healthy
ports:
- '3000:3000'
environment:
REDIS_URL: redis://redis:6379/1
DATABASE_URL: 'postgresql://postgres:password@postgres:5432/ip-scan?schema=public'
networks:
- local

networks:
local:
Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -e

yarn db:migrate
yarn start
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"start": "node ./dist/index.js",
"dev": "yarn nodemon ./src/index.ts | yarn pino-pretty",
"test": "yarn lab -v src/tests/** --typescript",
"docker:up": "docker-compose --file docker-compose.yaml up -d",
"docker:down": "docker-compose --file docker-compose.yaml down",
"docker:up": "docker compose --file docker-compose.yaml up -d",
"docker:down": "docker compose --file docker-compose.yaml down",
"db:generate": "yarn prisma generate",
"db:migrate": "yarn prisma migrate deploy",
"db:migrate-dev": "yarn prisma migrate dev",
Expand Down

0 comments on commit 81bb55c

Please sign in to comment.