chore: dockerize app and automate database initialization
This commit is contained in:
84
docker-compose.dev.yml
Normal file
84
docker-compose.dev.yml
Normal file
@@ -0,0 +1,84 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: tiptop-postgres-dev
|
||||
restart: unless-stopped
|
||||
|
||||
environment:
|
||||
POSTGRES_USER: tiptop
|
||||
POSTGRES_PASSWORD: tiptop_dev_password
|
||||
POSTGRES_DB: the_tip_top_db
|
||||
|
||||
volumes:
|
||||
- tiptop_postgres_dev_data:/var/lib/postgresql/data
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U tiptop -d the_tip_top_db"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
networks:
|
||||
- tiptop-dev
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
|
||||
container_name: tiptop-backend-dev
|
||||
restart: unless-stopped
|
||||
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
environment:
|
||||
PORT: 5000
|
||||
DATABASE_URL: postgresql://tiptop:tiptop_dev_password@postgres:5432/the_tip_top_db
|
||||
JWT_SECRET: dev_secret_change_me
|
||||
APP_URL: http://localhost:5000
|
||||
|
||||
MAIL_HOST: smtp.gmail.com
|
||||
MAIL_PORT: 587
|
||||
MAIL_USER: ""
|
||||
MAIL_PASS: ""
|
||||
MAIL_FROM: "The Tip Top <no-reply@tiptop.local>"
|
||||
|
||||
ports:
|
||||
- "5001:5000"
|
||||
|
||||
command: >
|
||||
sh -c "
|
||||
npx prisma migrate deploy &&
|
||||
npm run init:db &&
|
||||
npm start
|
||||
"
|
||||
|
||||
networks:
|
||||
- tiptop-dev
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
VITE_API_URL: http://localhost:5001
|
||||
|
||||
container_name: tiptop-frontend-dev
|
||||
restart: unless-stopped
|
||||
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
ports:
|
||||
- "5173:80"
|
||||
|
||||
networks:
|
||||
- tiptop-dev
|
||||
|
||||
volumes:
|
||||
tiptop_postgres_dev_data:
|
||||
|
||||
networks:
|
||||
tiptop-dev:
|
||||
Reference in New Issue
Block a user