demo-dockerwSubmodules/build_and_run.sh
2025-01-16 20:59:27 -03:00

40 lines
901 B
Bash
Executable file

#!/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