diff --git a/dc_files/build_and_run.sh b/dc_files/build_and_run.sh new file mode 100755 index 0000000..d6d50d3 --- /dev/null +++ b/dc_files/build_and_run.sh @@ -0,0 +1,40 @@ +#!/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 diff --git a/docker-compose.override.yml b/dc_files/docker-compose.override.yml similarity index 100% rename from docker-compose.override.yml rename to dc_files/docker-compose.override.yml diff --git a/docker-compose_ssh_git.yml b/dc_files/docker-compose_ssh_git.yml similarity index 100% rename from docker-compose_ssh_git.yml rename to dc_files/docker-compose_ssh_git.yml diff --git a/docker-compose.yml b/docker-compose.yml index 98aa1cb..b9ddce9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,6 @@ services: db: + container_name: demo-db image: postgres:13 volumes: - postgres_data:/var/lib/postgresql/data @@ -12,8 +13,8 @@ services: backend: build: - context: ../backend/ - dockerfile: Dockerfile + context: ${PWD}/../backend/ + # dockerfile: Dockerfile # entrypoint: ["${PWD}/../backend/entrypoint.sh"] command: sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000" ports: @@ -30,8 +31,8 @@ services: frontend: build: - context: ../frontend - dockerfile: Dockerfile + context: ${PWD}/../frontend + # dockerfile: Dockerfile # entrypoint: ["${PWD}/../frontend/entrypoint.sh"] command: sh -c "npm run dev -- --host 0.0.0.0" ports: