Skip to content

Commit

Permalink
Enhance Docker Setups for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmdksh committed Aug 13, 2024
1 parent c8c837c commit ccac02c
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 260 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#https://hub.docker.com/_/node?tab=tags&page=1
FROM node:20.11.0-alpine3.18
FROM node:20-alpine

WORKDIR /usr/src/app

Expand All @@ -22,4 +21,4 @@ COPY src ./src
COPY test ./test
COPY migration ./migration

RUN npm run build
RUN npm run build
47 changes: 0 additions & 47 deletions docker-compose-develop.yml

This file was deleted.

44 changes: 0 additions & 44 deletions docker-compose-local-postgres-db-readonly.yml

This file was deleted.

55 changes: 0 additions & 55 deletions docker-compose-local-postgres-redis.yml

This file was deleted.

32 changes: 0 additions & 32 deletions docker-compose-local.yml

This file was deleted.

47 changes: 15 additions & 32 deletions docker-compose-production.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,30 @@
version: '3.3'

services:
impact-graph:
#see https://github.com/docker/build-push-action/tree/releases/v1#tag_with_ref

# is sometime you want to rollback you can change the tag manually in server( not commit to git)
# from master to your desired commit hash and the run command:
# 1. docker-compose -f docker-compose-production.yml pull
# 2. docker-compose -f docker-compose-production.yml down
# 3. docker-compose -f docker-compose-production.yml up -d
image: ghcr.io/giveth/impact-graph:latest
qacc-be:
container_name: qacc-be
build: .
command: npm run start:docker:server
environment:
- ENVIRONMENT=production
- LOG_PATH=/usr/src/app/logs/impact-graph.log
- LOG_PATH=/usr/src/app/logs/qacc.log
restart: always
volumes:
# You should have a production.env file in the config folder
# We should bind config in two path, I think because running migrations(ts) needs one and running
# application(js) read from another path, if we change migrations two run them as js files then we need just on binding
- type: bind
source: ./config
target: /usr/src/app/config
- type: bind
source: ./config
target: /usr/src/app/build/config
- type: bind
source: ./logs
target: /usr/src/app/logs
- ./config:/usr/src/app/config
- ./config:/usr/src/app/build/config
- ./logs:/usr/src/app/logs
ports:
- "4000:4000"
depends_on:
- redis-giveth
- "4001:4000"

redis-giveth:
# it's better to not using the latest tag, maybe latest tag have some breaking changes
image: redis:7.2.0-alpine3.18
container_name: redis-giveth
qacc-redis:
container_name: qacc-redis
image: redis:7-alpine
environment:
- REDIS_ALLOW_EMPTY_PASSWORD=yes
restart: always
volumes:
- redis-data:/data
ports:
- "6379:6379"

volumes:
redis-data:
db-data:
redis-data:
47 changes: 0 additions & 47 deletions docker-compose-staging.yml

This file was deleted.

44 changes: 44 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
services:
qacc-be:
container_name: qacc-be
build: .
command: npm run start:docker:locally
environment:
- ENVIRONMENT=local
- LOG_PATH=/usr/src/app/logs/qacc.log
restart: always
volumes:
- ./config:/usr/src/app/config
- ./config:/usr/src/app/build/config
- ./logs:/usr/src/app/logs
ports:
- "4001:4000"

qacc-postgres:
container_name: qacc-postgres
image: postgres:16
restart: always
environment:
- POSTGRES_DB=qacc
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- db-data:/var/lib/postgresql/data
ports:
- "5432:5432"

qacc-redis:
container_name: qacc-redis
image: redis:7-alpine
environment:
- REDIS_ALLOW_EMPTY_PASSWORD=yes
restart: always
volumes:
- redis-data:/data
ports:
- "6379:6379"

volumes:
db-data:
redis-data:

0 comments on commit ccac02c

Please sign in to comment.