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