From f8bdccd8fe20060b8bc33dafa14f0bd48c1ccbb7 Mon Sep 17 00:00:00 2001 From: Stephen Fraser Date: Wed, 20 Nov 2024 15:54:25 +0000 Subject: [PATCH] Dockerfile and compose --- Dockerfile | 3 +-- docker-compose.yaml | 55 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile index ea97e93..63d5d46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ WORKDIR /home/node/app ADD ./package.json /home/node/app/package.json ADD ./yarn.lock /home/node/app/yarn.lock -RUN LDFLAGS='-static-libgcc -static-libstdc++' yarn install --production --no-interactive --frozen-lockfile +RUN yarn install --production --no-interactive --frozen-lockfile FROM node:lts-bullseye-slim @@ -56,4 +56,3 @@ COPY ./migrations /home/node/app/migrations COPY ./config.json /home/node/app/config.json CMD ["node_modules/.bin/pm2-runtime", "start", "./ecosystem.config.js", "--only", "tasks-api-prod"] - diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..4f6b39c --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,55 @@ +services: + + gateway-redis: + image: redis:5-alpine + + shared-postgres: + image: ghcr.io/digirati-co-uk/madoc-postgres:main + platform: linux/amd64 + environment: + - POSTGRES_DB=postgres + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres_password + - POSTGRES_MADOC_TS_USER=madoc_ts + - POSTGRES_MADOC_TS_SCHEMA=madoc_ts + - POSTGRES_MADOC_TS_PASSWORD=madoc_ts_password + - POSTGRES_TASKS_API_USER=tasks_api + - POSTGRES_TASKS_API_SCHEMA=tasks_api + - POSTGRES_TASKS_API_PASSWORD=tasks_api_password + - POSTGRES_MODELS_API_USER=models_api + - POSTGRES_MODELS_API_SCHEMA=models_api + - POSTGRES_MODELS_API_PASSWORD=models_api_password + - POSTGRES_CONFIG_SERVICE_USER=config_service + - POSTGRES_CONFIG_SERVICE_SCHEMA=config_service + - POSTGRES_CONFIG_SERVICE_PASSWORD=config_service_password + - POSTGRES_SEARCH_API_USER=search_api + - POSTGRES_SEARCH_API_SCHEMA=search_api + - POSTGRES_SEARCH_API_PASSWORD=search_api_password + volumes: + - shared_postgres_data:/var/lib/postgresql/data:Z + ports: + - "${PORTS_SHARED_POSTGRES:-5401}:5432" + + tasks-api: + build: + dockerfile: Dockerfile + restart: on-failure + environment: + - SERVER_PORT=3000 + - DATABASE_HOST=shared-postgres + - DATABASE_NAME=postgres + - DATABASE_PORT=5432 + - DATABASE_USER=tasks_api + - DATABASE_SCHEMA=tasks_api + - DATABASE_PASSWORD=tasks_api_password + - QUEUE_LIST=tasks-api,madoc-ts + - REDIS_HOST=gateway-redis + links: + - shared-postgres + - gateway-redis + ports: + - "3000:3000" + +volumes: + # Databases + shared_postgres_data: {}