From 8ee2f7e17f2f5ecadb0d8fbf1b4b50686cfc7c13 Mon Sep 17 00:00:00 2001 From: Diego Magdaleno Date: Sun, 9 May 2021 10:48:13 -0500 Subject: [PATCH] Docker: Begin dockerization --- .docker/data/.keep | 0 .docker/env | 1 + .docker/mongodb/mongod.conf | 2 ++ .gitignore | 4 +++- docker-compose.yml | 26 ++++++++++++++++++++++++++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .docker/data/.keep create mode 100644 .docker/env create mode 100644 .docker/mongodb/mongod.conf create mode 100644 docker-compose.yml diff --git a/.docker/data/.keep b/.docker/data/.keep new file mode 100644 index 0000000..e69de29 diff --git a/.docker/env b/.docker/env new file mode 100644 index 0000000..df6d28c --- /dev/null +++ b/.docker/env @@ -0,0 +1 @@ +MONGO_URL=mongodb://mongo:27017/fosscord?readPreference=secondaryPreferred \ No newline at end of file diff --git a/.docker/mongodb/mongod.conf b/.docker/mongodb/mongod.conf new file mode 100644 index 0000000..cbe0a2a --- /dev/null +++ b/.docker/mongodb/mongod.conf @@ -0,0 +1,2 @@ +replication: + replSetName: "rs0" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 54fd98d..44f9f5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules/ -.DS_STORE \ No newline at end of file +.DS_STORE +.docker/data/* +!.docker/data/.keep \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3a4eae5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: "3" +services: + fosscord-gateway: + container_name: gateway + restart: always + build: gateway + ports: + - "3002:3002" + links: + - mongo + env_file: ./.docker/env + fosscord-api: + container_name: api + restart: always + build: api + ports: + - "3001:3001" + mongo: + container_name: mongo + image: mongo + volumes: + - ./.docker/data:/data/db + - ./.docker/mongodb/mongod.conf:/etc/mongod.conf + ports: + - "27017:27017" + command: ["-f", "/etc/mongod.conf"] \ No newline at end of file