From 3ab9b0c7a4ab856979c51ae10384c4e715ab2334 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Mon, 13 Feb 2023 08:14:48 +0100 Subject: [PATCH] fix(#166): fix docker build --- .dockerignore | 6 ++++-- Dockerfile | 5 ++--- docker-compose.yml | 15 ++++++++++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.dockerignore b/.dockerignore index e159107..75375b7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,5 @@ /repositories -repo/ -db_backups \ No newline at end of file +db_backups +build +node_modules +.github \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4378330..c07bf6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,12 @@ EXPOSE $PORT WORKDIR /app -RUN npm install pm2 -g -RUN pm2 install typescript +RUN npm install pm2 -g && pm2 install typescript && npm cache clean --force; COPY package.json . COPY package-lock.json . -RUN npm install +RUN npm install && npm run build && npm cache clean --force COPY ecosystem.config.js . COPY healthcheck.js . diff --git a/docker-compose.yml b/docker-compose.yml index 022daa9..589b5d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,6 @@ services: environment: - REDIS_HOSTNAME=redis - DB_HOSTNAME=mongodb - volumes: - - .:/app ports: - $PORT:$PORT healthcheck: @@ -28,12 +26,19 @@ services: redis: image: "redis:alpine" - + restart: always + healthcheck: + test: + - CMD + - redis-cli + - ping + interval: 10s + timeout: 10s + retries: 5 + mongodb: image: mongo:latest restart: on-failure - ports: - - "127.0.0.1:27017:27017" environment: MONGO_INITDB_ROOT_USERNAME: $DB_USERNAME MONGO_INITDB_ROOT_PASSWORD: $DB_PASSWORD