finally fixed ...
This commit is contained in:
parent
8996a9a730
commit
552a153fdf
4 changed files with 45 additions and 4 deletions
40
dc_files/build_and_run.sh
Executable file
40
dc_files/build_and_run.sh
Executable file
|
@ -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
|
|
@ -1,5 +1,6 @@
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
|
container_name: demo-db
|
||||||
image: postgres:13
|
image: postgres:13
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
@ -12,8 +13,8 @@ services:
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: ../backend/
|
context: ${PWD}/../backend/
|
||||||
dockerfile: Dockerfile
|
# dockerfile: Dockerfile
|
||||||
# entrypoint: ["${PWD}/../backend/entrypoint.sh"]
|
# entrypoint: ["${PWD}/../backend/entrypoint.sh"]
|
||||||
command: sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
|
command: sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
|
||||||
ports:
|
ports:
|
||||||
|
@ -30,8 +31,8 @@ services:
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
build:
|
build:
|
||||||
context: ../frontend
|
context: ${PWD}/../frontend
|
||||||
dockerfile: Dockerfile
|
# dockerfile: Dockerfile
|
||||||
# entrypoint: ["${PWD}/../frontend/entrypoint.sh"]
|
# entrypoint: ["${PWD}/../frontend/entrypoint.sh"]
|
||||||
command: sh -c "npm run dev -- --host 0.0.0.0"
|
command: sh -c "npm run dev -- --host 0.0.0.0"
|
||||||
ports:
|
ports:
|
||||||
|
|
Loading…
Reference in a new issue