.env.for-docker-compose
This commit is contained in:
43
.env.for-docker-compose
Normal file
43
.env.for-docker-compose
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Postgres
|
||||||
|
DB_USER=postgres
|
||||||
|
DB_PASSWORD=password
|
||||||
|
DB_NAME=nestjs_blog
|
||||||
|
|
||||||
|
# Backend (NestJS)
|
||||||
|
NODE_ENV=production
|
||||||
|
HOST=0.0.0.0
|
||||||
|
BACKEND_PORT=3001
|
||||||
|
APP_URL=http://localhost:3001
|
||||||
|
|
||||||
|
DB_HOST=postgres
|
||||||
|
DB_PORT=5432
|
||||||
|
DB_SSL=false
|
||||||
|
|
||||||
|
JWT_ACCESS_SECRET=change-me-access-secret-at-least-32-chars
|
||||||
|
JWT_REFRESH_SECRET=change-me-refresh-secret-at-least-32-chars
|
||||||
|
JWT_ACCESS_EXPIRES_IN=15m
|
||||||
|
JWT_REFRESH_EXPIRES_IN=7d
|
||||||
|
|
||||||
|
MAGIC_LINK_TTL_MINUTES=20
|
||||||
|
PASSWORD_RESET_TTL_MINUTES=30
|
||||||
|
|
||||||
|
COOKIE_SECURE=false
|
||||||
|
COOKIE_DOMAIN=
|
||||||
|
|
||||||
|
MAIL_FROM=no-reply@blog.local
|
||||||
|
SMTP_HOST=
|
||||||
|
SMTP_PORT=587
|
||||||
|
SMTP_USER=
|
||||||
|
SMTP_PASS=
|
||||||
|
|
||||||
|
GOOGLE_CLIENT_ID=
|
||||||
|
GOOGLE_CLIENT_SECRET=
|
||||||
|
GOOGLE_CALLBACK_URL=http://localhost:3001/auth/google/callback
|
||||||
|
|
||||||
|
FRONTEND_URL=http://localhost:3000
|
||||||
|
|
||||||
|
# Frontend (Next.js)
|
||||||
|
FRONTEND_PORT=3000
|
||||||
|
NEXT_PUBLIC_API_URL=http://localhost:3001
|
||||||
|
UPLOAD_R2_WORKER_API=***.workers.dev
|
||||||
|
R2_UPLOAD_API_KEY=***
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
@@ -5,15 +5,15 @@ services:
|
|||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: ${DB_USER:-postgres}
|
POSTGRES_USER: ${DB_USER}
|
||||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
POSTGRES_DB: ${DB_NAME:-nestjs_blog}
|
POSTGRES_DB: ${DB_NAME}
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-nestjs_blog}"]
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
@@ -23,26 +23,51 @@ services:
|
|||||||
context: ./backend
|
context: ./backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
environment:
|
||||||
- ./backend/.env
|
NODE_ENV: ${NODE_ENV}
|
||||||
|
HOST: ${HOST}
|
||||||
|
PORT: ${BACKEND_PORT}
|
||||||
|
APP_URL: ${APP_URL}
|
||||||
|
DB_HOST: ${DB_HOST}
|
||||||
|
DB_PORT: ${DB_PORT}
|
||||||
|
DB_USER: ${DB_USER}
|
||||||
|
DB_PASSWORD: ${DB_PASSWORD}
|
||||||
|
DB_NAME: ${DB_NAME}
|
||||||
|
DB_SSL: ${DB_SSL}
|
||||||
|
JWT_ACCESS_SECRET: ${JWT_ACCESS_SECRET}
|
||||||
|
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET}
|
||||||
|
JWT_ACCESS_EXPIRES_IN: ${JWT_ACCESS_EXPIRES_IN}
|
||||||
|
JWT_REFRESH_EXPIRES_IN: ${JWT_REFRESH_EXPIRES_IN}
|
||||||
|
MAGIC_LINK_TTL_MINUTES: ${MAGIC_LINK_TTL_MINUTES}
|
||||||
|
PASSWORD_RESET_TTL_MINUTES: ${PASSWORD_RESET_TTL_MINUTES}
|
||||||
|
COOKIE_SECURE: ${COOKIE_SECURE}
|
||||||
|
COOKIE_DOMAIN: ${COOKIE_DOMAIN}
|
||||||
|
MAIL_FROM: ${MAIL_FROM}
|
||||||
|
SMTP_HOST: ${SMTP_HOST}
|
||||||
|
SMTP_PORT: ${SMTP_PORT}
|
||||||
|
SMTP_USER: ${SMTP_USER}
|
||||||
|
SMTP_PASS: ${SMTP_PASS}
|
||||||
|
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
|
||||||
|
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
|
||||||
|
GOOGLE_CALLBACK_URL: ${GOOGLE_CALLBACK_URL}
|
||||||
|
FRONTEND_URL: ${FRONTEND_URL}
|
||||||
ports:
|
ports:
|
||||||
- "3001:3001"
|
- "${BACKEND_PORT}:${BACKEND_PORT}"
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
volumes:
|
|
||||||
- ./backend:/app
|
|
||||||
- /app/node_modules
|
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
environment:
|
||||||
- ./frontend/.env
|
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
|
||||||
|
UPLOAD_R2_WORKER_API: ${UPLOAD_R2_WORKER_API}
|
||||||
|
R2_UPLOAD_API_KEY: ${R2_UPLOAD_API_KEY}
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "${FRONTEND_PORT}:${FRONTEND_PORT}"
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user