fix(docker): add credentials fields to auth provider, postgres service, expose port 5433, AUTH_URL/AUTH_TRUST_HOST in env example
This commit is contained in:
@@ -18,3 +18,4 @@ OPENAI_API_KEY=sk-your-openai-key
|
|||||||
|
|
||||||
# Application
|
# Application
|
||||||
APP_BASE_URL=https://yourdomain.com
|
APP_BASE_URL=https://yourdomain.com
|
||||||
|
AUTH_TRUST_HOST=true
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# Stage 1: Install production dependencies
|
# Stage 1: Install all dependencies (including devDeps needed for build)
|
||||||
FROM --platform=linux/amd64 node:20-slim AS deps
|
FROM --platform=linux/amd64 node:20-slim AS deps
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm ci --omit=dev
|
RUN npm ci
|
||||||
|
|
||||||
# Stage 2: Build the application
|
# Stage 2: Build the application
|
||||||
FROM --platform=linux/amd64 node:20-slim AS builder
|
FROM --platform=linux/amd64 node:20-slim AS builder
|
||||||
|
|||||||
@@ -1,11 +1,28 @@
|
|||||||
services:
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "5433:5432"
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: teressa
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
app:
|
app:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3001:3000"
|
||||||
env_file:
|
env_file:
|
||||||
- .env.production
|
- .env.production
|
||||||
environment:
|
environment:
|
||||||
@@ -15,6 +32,10 @@ services:
|
|||||||
- 1.1.1.1
|
- 1.1.1.1
|
||||||
volumes:
|
volumes:
|
||||||
- uploads:/app/uploads
|
- uploads:/app/uploads
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
uploads:
|
uploads:
|
||||||
|
pgdata:
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
|
|||||||
...authConfig,
|
...authConfig,
|
||||||
providers: [
|
providers: [
|
||||||
Credentials({
|
Credentials({
|
||||||
|
credentials: {
|
||||||
|
email: { label: "Email", type: "email" },
|
||||||
|
password: { label: "Password", type: "password" },
|
||||||
|
},
|
||||||
async authorize(credentials) {
|
async authorize(credentials) {
|
||||||
const parsed = loginSchema.safeParse(credentials);
|
const parsed = loginSchema.safeParse(credentials);
|
||||||
if (!parsed.success) return null;
|
if (!parsed.success) return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user