From 424afb4b83225bfbc131987b746b5bcacc0ba7bb Mon Sep 17 00:00:00 2001 From: andrechristikan Date: Sun, 10 Nov 2024 23:55:04 +0700 Subject: [PATCH] fix: docker installation --- README.md | 13 ++++++++----- docker-compose.yml | 17 +++++++++++++++++ package.json | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bcddecc8..aebc147a 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ _You can [request feature][ack-issues] or [report bug][ack-issues] with followin - [Database Migration and Seed](#database-migration-and-seed) - [Template Migration](#template-migration) - [Run Project](#run-project) - - [Installation dependencies with Docker](#installation-dependencies-with-docker) + - [Installation with Docker](#installation-with-docker) - [Test](#test) - [Swagger](#swagger) - [API Key](#api-key) @@ -207,16 +207,19 @@ Now you can run the project. yarn start:dev ``` -## Installation dependencies with Docker - -> Docker will install mongodb (as replication set), and redis +## Installation with Docker We need more tools to be installed. 1. [Docker][ref-docker] 2. [Docker-Compose][ref-dockercompose] -After clone this project, then run +Copy `.env.example` and change value + +1. `DATABASE_URL`: `DATABASE_URL=mongodb://host.docker.internal:27017,host.docker.internal:27018,host.docker.internal:27019/ack?retryWrites=true&w=majority&replicaSet=rs0` +2. `REDIS_HOST`: `redis` + +leave the rest as it, then run ```bash docker-compose up -d diff --git a/docker-compose.yml b/docker-compose.yml index 4f423ffd..c7e3de5d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,23 @@ name: ack services: + apis: + build: + context: . + container_name: apis + hostname: apis + ports: + - 3000:3000 + volumes: + - ./src/:/app/src/ + - .env/:/app/.env + restart: always + networks: + - app-network + depends_on: + - redis + - mongodb1 + redis: image: redis:latest container_name: redis diff --git a/package.json b/package.json index b2852641..5df8d4e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ack-nestjs-boilerplate", - "version": "7.1.2", + "version": "7.1.3", "description": "Ack NestJs Boilerplate", "repository": { "type": "git",