diff --git a/README.md b/README.md index 0171da5..05364ce 100644 --- a/README.md +++ b/README.md @@ -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. 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. run: ```docker compose up --build``` run: ```docker-compose exec backend python manage.py createsuperuser``` and create a user in the backend. diff --git a/docker-compose.yml b/docker-compose.yml index fb4abd5..9a9f6b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,10 +12,8 @@ services: backend: build: - context: git@git.impstyle.com:test/demo-backend.git#main # Replace with your backend repo URL + context: ./backend dockerfile: Dockerfile - ssh: - - default:/path/to/keyfile ports: - "8000:8000" environment: @@ -30,10 +28,8 @@ services: frontend: build: - context: git@git.impstyle.com:test/demo-frontend.git#main # Replace with your frontend repo URL + context: ./frontend dockerfile: Dockerfile - ssh: - - default:/path/to/keyfile ports: - "5173:5173" environment: diff --git a/docker-compose_ssh_git.yml b/docker-compose_ssh_git.yml new file mode 100644 index 0000000..e37b29a --- /dev/null +++ b/docker-compose_ssh_git.yml @@ -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: