dc.yml fixed

This commit is contained in:
zwnk 2025-01-16 15:20:30 -03:00
parent 1384afd264
commit d39ecb84c3
3 changed files with 62 additions and 7 deletions

View file

@ -3,7 +3,25 @@
This is just a small Vue.js demo app with a Django Rest API Backend that writes "Todos" to a Postgesql DB. This is just a small Vue.js demo app with a Django Rest API Backend that writes "Todos" to a Postgesql DB.
It serves as demo to on how to setup the containerization with docker. It serves as demo to on how to setup the containerization with docker.
clone the repo. # How to use/deploy
## Simple Way
Clone the 3 repos into the folder:
```mkdir TestProject && cd TestProject```
```git clone ssh://git@git.impstyle.com:222/test/demo-docker.git docker```
```git clone ssh://git@git.impstyle.com:222/test/demo-fronted.git frontend```
```git clone ssh://git@git.impstyle.com:222/test/demo-backend.git backend```
## SSH git clone via docker compose
Have a valid ssh key pair with the Git server provider.
adjust the path to the frontend and backend repos inside `docker-compose_ssh_git.yml`
run ```docker compose build -f docker-compose_ssh_git.yml --ssh default```
this path is tricky because you have to do more to make the ssh keys working with the docker compose instance.
## how to start the application
Adjust the .env files. Adjust the .env files.
run: ```docker compose up --build``` run: ```docker compose up --build```
run: ```docker-compose exec backend python manage.py createsuperuser``` and create a user in the backend. run: ```docker-compose exec backend python manage.py createsuperuser``` and create a user in the backend.

View file

@ -12,10 +12,8 @@ services:
backend: backend:
build: build:
context: git@git.impstyle.com:test/demo-backend.git#main # Replace with your backend repo URL context: ./backend
dockerfile: Dockerfile dockerfile: Dockerfile
ssh:
- default:/path/to/keyfile
ports: ports:
- "8000:8000" - "8000:8000"
environment: environment:
@ -30,10 +28,8 @@ services:
frontend: frontend:
build: build:
context: git@git.impstyle.com:test/demo-frontend.git#main # Replace with your frontend repo URL context: ./frontend
dockerfile: Dockerfile dockerfile: Dockerfile
ssh:
- default:/path/to/keyfile
ports: ports:
- "5173:5173" - "5173:5173"
environment: environment:

View file

@ -0,0 +1,41 @@
services:
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: ssh://git@git.impstyle.com:222/test/demo-backend.git#main # Replace with your backend repo URL
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
- DB_NAME=todo_db
- DB_USER=postgres
- DB_PASSWORD=postgres
- DB_HOST=db
- DB_PORT=5432
- DEBUG=1
depends_on:
- db
frontend:
build:
context: ssh://git@git.impstyle.com:222/test/demo-frontend.git#main # Replace with your frontend repo URL
dockerfile: Dockerfile
ports:
- "5173:5173"
environment:
- VITE_API_URL=http://localhost:8000/api
depends_on:
- backend
volumes:
postgres_data: