From f59f73c8e39079619cd3a1209b91ac5ca3cd6ba0 Mon Sep 17 00:00:00 2001 From: Igor Savin Date: Thu, 18 Jul 2024 13:27:31 +0300 Subject: [PATCH] Add Redis --- .github/workflows/ci.yml | 6 ++++++ docker-compose.yml | 24 ++++++++++++++++++++++++ package.json | 2 ++ 3 files changed, 32 insertions(+) create mode 100644 docker-compose.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8a6b52..e37e6f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,9 @@ jobs: run: | npm install + - name: Start Docker + run: npm run docker:start + - name: Build TS run: | npm run build @@ -31,6 +34,9 @@ jobs: run: | npm run test:ci + - name: Stop Docker + run: npm run docker:stop + automerge: needs: build runs-on: ubuntu-latest diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b6cc50e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: "3.8" +services: + redis: + image: "redis:7-alpine" + + command: redis-server --requirepass sOmE_sEcUrE_pAsS + + ports: + - "6379:6379" + + environment: + - REDIS_REPLICATION_MODE=master + + wait_for_redis: + image: "redis:7-alpine" + + depends_on: + - redis + command: sh -c "/wait && /sayhello" + environment: + - WAIT_HOSTS=redis:6379 + - WAIT_HOSTS_TIMEOUT=300 + - WAIT_SLEEP_INTERVAL=30 + - WAIT_HOST_CONNECT_TIMEOUT=30 diff --git a/package.json b/package.json index 92a4ccb..b5dae12 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,8 @@ "test:ci": "npm run lint && npm run test:coverage", "lint": "eslint . --ext .ts && prettier --check --log-level warn \"**/*.{json,md,ts}\" !CHANGELOG.md", "lint:fix": "eslint . --fix && prettier --write --log-level warn \"**/*.{json,md,ts}\" !CHANGELOG.md", + "docker:start": "docker-compose -f docker-compose.yml up --build -d redis && docker-compose -f docker-compose.yml up --build -d wait_for_redis", + "docker:stop": "docker-compose -f docker-compose.yml down", "version": "auto-changelog -p && git add CHANGELOG.md" }, "dependencies": {