Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:20-alpine

WORKDIR /app

RUN corepack enable && corepack prepare pnpm@latest --activate

COPY package.json pnpm-lock.yaml ./

RUN pnpm install

COPY . .

CMD ["pnpm", "start:dev"]
62 changes: 62 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
version: "3.9"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think docker-compose now doesn't need this line, but it's ok


services:
app:
image: postgres:13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

postgres 13? that's way too old bro, and also we need to use the alpine version for both postgres and redis.
I think we should use postgres17-alpine

container_name: multi_tenant_db
environment:
POSTGRES_USER: user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think also here we could make use of env variables?

POSTGRES_PASSWORD: postgres8090
POSTGRES_DB: Multi-Tenant
ports:
- "5432:5432"
networks:
- backend
volumes:
- app_data:/var/lib/postgresql/data
restart: unless-stopped

cache:
image: redis:6
container_name: redis_cache
ports:
- "6379:6379"
networks:
- backend
volumes:
- cache_data:/data
restart: unless-stopped

api:
container_name: multi_tenant_api
build:
context: .
dockerfile: Dockerfile
command: pnpm run start:dev
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
environment:
DATABASE_HOST: app
DATABASE_PORT: 5432
DATABASE_USER: user
DATABASE_PASSWORD: postgres8090
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same here for env variables

DATABASE_NAME: Multi-Tenant
REDIS_HOST: cache
REDIS_PORT: 6379
depends_on:
- app
- cache
networks:
- backend
restart: unless-stopped

networks:
backend:
driver: bridge

volumes:
app_data:
cache_data: