lll
This commit is contained in:
parent
f8091d2d66
commit
86b48b2ac8
3 changed files with 47 additions and 40 deletions
|
@ -1,40 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Build images
|
||||
docker build -t demo-frontend ../frontend
|
||||
docker build -t demo-backend ../backend
|
||||
|
||||
# Create network if it doesn't exist
|
||||
docker network create demo-network || true
|
||||
|
||||
# Start PostgreSQL
|
||||
docker run -d \
|
||||
--name demo-db \
|
||||
--network demo-network \
|
||||
-e POSTGRES_DB=todo_db \
|
||||
-e POSTGRES_USER=postgres \
|
||||
-e POSTGRES_PASSWORD=postgres \
|
||||
-p 5432:5432 \
|
||||
-v postgres_data:/var/lib/postgresql/data \
|
||||
postgres:13
|
||||
|
||||
# Start Backend
|
||||
docker run -d \
|
||||
--name demo-backend \
|
||||
--network demo-network \
|
||||
-e DB_NAME=todo_db \
|
||||
-e DB_USER=postgres \
|
||||
-e DB_PASSWORD=postgres \
|
||||
-e DB_HOST=demo-db \
|
||||
-e DB_PORT=5432 \
|
||||
-e DEBUG=1 \
|
||||
-p 8000:8000 \
|
||||
demo-backend
|
||||
|
||||
# Start Frontend
|
||||
docker run -d \
|
||||
--name demo-frontend \
|
||||
--network demo-network \
|
||||
-e VITE_API_URL=http://localhost:8000/api \
|
||||
-p 5173:5173 \
|
||||
demo-frontend
|
|
@ -1,5 +1,6 @@
|
|||
services:
|
||||
demo-db:
|
||||
container_name: db
|
||||
image: postgres:13
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
|
|
46
docker-compose_development.yml
Normal file
46
docker-compose_development.yml
Normal file
|
@ -0,0 +1,46 @@
|
|||
services:
|
||||
demo-db:
|
||||
container_name: db
|
||||
image: postgres:13
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_DB=todo_db
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend/
|
||||
command: sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- DB_NAME=todo_db
|
||||
- DB_USER=postgres
|
||||
- DB_PASSWORD=postgres
|
||||
- DB_HOST=db
|
||||
- DB_PORT=5432
|
||||
- DEBUG=1
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
depends_on:
|
||||
- demo-db
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
command: sh -c "npm run dev -- --host 0.0.0.0"
|
||||
ports:
|
||||
- "5173:5173"
|
||||
environment:
|
||||
- VITE_API_URL=http://localhost:8000/api
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
Loading…
Reference in a new issue