Skip to content
Merged
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
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ JWT_REFRESH_SECRET_KEY=CHANGE_ME
JWT_REFRESH_EXPIRES_IN=2h
# Throttle - Rate limiting
THROTTLE_TTL=60000
THROTTLE_LIMIT=10
THROTTLE_LIMIT=10
# Super admin data
SUPER_ADMIN_EMAIL=SUPERADMIN@EXAMPLE.COM
SUPER_ADMIN_PASSWORD=PASSWORD
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ WORKDIR /app
# Dependencies
FROM base AS deps
COPY package.json pnpm-lock.yaml ./
# To run postinstall prisma folder needed
COPY prisma ./prisma
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install --frozen-lockfile
pnpm install --frozen-lockfile --ignore-scripts

# Development stage
FROM deps AS development
Expand All @@ -18,6 +16,7 @@ COPY . .
# Build stage
FROM deps AS build
COPY . .
RUN pnpm prisma generate
RUN pnpm build

# Production stage
Expand All @@ -27,6 +26,6 @@ WORKDIR /app
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=build /app/package.json ./
COPY --from=build /app/generated ./generated
COPY --from=build /app/prisma ./prisma
COPY --from=build /app/prisma.config.ts ./prisma.config.ts
CMD ["sh", "-c", "pnpm prisma migrate deploy && pnpm start:prod"]
COPY --from=build /app/prisma.config.ts ./prisma.config.ts
6 changes: 3 additions & 3 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ services:
target: development
container_name: dev_api
command: >
sh -c "pnpm prisma migrate deploy &&
pnpm prisma db seed &&
sh -c "pnpm prisma migrate deploy &&
pnpm prisma db seed &&
pnpm start:dev"
ports:
- '3001:3000'
Expand Down Expand Up @@ -47,7 +47,7 @@ services:
volumes:
- dev_redis_data:/data
ports:
- '6378:6379'
- '6371:6379'
networks:
- infra_net
volumes:
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ services:
context: .
target: production
container_name: prod_api
command: >
sh -c "pnpm prisma migrate deploy &&
pnpm prisma db seed &&
pnpm start:prod"
ports:
- '3000:3000'
env_file:
Expand All @@ -17,6 +21,8 @@ services:
prod-db:
image: postgres:16-alpine
container_name: prod_db
ports:
- '5432:5432'
env_file:
- .env.production
volumes:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"prepare": "husky"
},
"lint-staged": {
"{src,apps,libs,test}/**/*.ts": [
"{src,apps,libs,test,prisma}/**/*.ts": [
"prettier --write",
"eslint --fix --max-warnings=0"
]
Expand All @@ -55,7 +55,7 @@
"dotenv": "^17.3.1",
"ioredis": "^5.10.0",
"joi": "^18.0.2",
"pg": "^8.20.0",
"pg": "^8.18.0",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1",
"uuid": "^11.1.0"
Expand All @@ -73,7 +73,7 @@
"@types/express": "^5.0.0",
"@types/jest": "^30.0.0",
"@types/node": "^22.10.7",
"@types/pg": "^8.11.11",
"@types/pg": "8.11.11",
"@types/supertest": "^6.0.2",
"dotenv-cli": "^11.0.0",
"eslint": "^9.18.0",
Expand Down
Loading
Loading