From db2d455c02aa5b701df8e375cb1c229f3c06fe76 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 14 Nov 2021 18:56:17 +0100 Subject: [PATCH] Add docker-compose to deployment --- deployment/todo-setup.yml | 6 ++++++ src/.gitignore | 2 ++ src/docker-compose.prod.yml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 src/.gitignore create mode 100644 src/docker-compose.prod.yml diff --git a/deployment/todo-setup.yml b/deployment/todo-setup.yml index eea9ae0..f2eded9 100644 --- a/deployment/todo-setup.yml +++ b/deployment/todo-setup.yml @@ -7,3 +7,9 @@ dest: /home/hermansen/git/git.kjuulh.io/kjuulh/todo single_branch: yes version: production + + - name: deploy remote docker containers using compose + community.docker.docker_compose: + project_src: ../src/ + files: + - docker-compose.prod.yml diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..ba7b92e --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,2 @@ +.proc.env +.staging.env diff --git a/src/docker-compose.prod.yml b/src/docker-compose.prod.yml new file mode 100644 index 0000000..573ca06 --- /dev/null +++ b/src/docker-compose.prod.yml @@ -0,0 +1,31 @@ +version: "3" + +services: + db: + build: + context: backend/db + ports: + - 27017:27017 + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: example + + server: + build: + context: backend/server + ports: + - 5000:80 + environment: + MONGODB__Username: root + MONGODB__Password: example + MONGODB__Host: db + MONGODB__Port: 27017 + MONGODB__Database: todo + depends_on: + - db + + client: + build: + context: client + ports: + - 3000:3000