Commit b8bcdadc authored by ThinhNC's avatar ThinhNC

fix(deployment): stabilize Docker build and Redis configuration

parent b87a2723
......@@ -14,7 +14,7 @@ JWT_ACCESS_EXPIRES_IN=1d
JWT_REFRESH_EXPIRES_IN=7d
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PORT=7379
REDIS_PASSWORD=
REDIS_ENABLED=true
......
......@@ -3,12 +3,16 @@ FROM node:20-alpine AS builder
WORKDIR /usr/src/app
# Prisma requires OpenSSL for its query engine.
RUN apk add --no-cache openssl
# Enable corepack to use pnpm defined in package.json
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
# Copy package descriptors first to leverage Docker layer caching
COPY package.json pnpm-lock.yaml ./
COPY prisma/schema.prisma ./prisma/
COPY scripts/prisma-run.js ./scripts/prisma-run.js
# Install all dependencies (including devDependencies)
RUN pnpm install --frozen-lockfile
......@@ -28,6 +32,9 @@ FROM node:20-alpine AS runner
WORKDIR /usr/src/app
# Prisma requires OpenSSL for its query engine.
RUN apk add --no-cache openssl
# Enable corepack to use pnpm
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
......@@ -47,9 +54,6 @@ RUN pnpm install --prod --frozen-lockfile
# Copy compiled files from builder stage
COPY --from=builder /usr/src/app/dist ./dist
# Copy generated Prisma Client from builder stage
COPY --from=builder /usr/src/app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /usr/src/app/node_modules/@prisma/client ./node_modules/@prisma/client
# Use non-root node user for security hardening
USER node
......
version: "3.8"
services:
postgres:
image: postgres:16-alpine
......@@ -22,7 +20,7 @@ services:
image: redis:7-alpine
container_name: finwise_redis
ports:
- "${REDIS_PORT:-6381}:6379"
- "${REDIS_PORT:-7379}:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
......@@ -58,4 +56,3 @@ services:
volumes:
postgres_data:
......@@ -10,8 +10,8 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"declaration": false,
"declarationMap": false,
"sourceMap": true,
"noUnusedLocals": false,
"noUnusedParameters": false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment