demo-dockerwSubmodules/build_and_run.sh

41 lines
901 B
Bash
Raw Normal View History

2025-01-17 00:59:27 +01:00
#!/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