.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
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${DB_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
|
||||
POSTGRES_DB: ${DB_NAME:-nestjs_blog}
|
||||
POSTGRES_USER: ${DB_USER}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
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
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
@@ -23,26 +23,51 @@ services:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- ./backend/.env
|
||||
environment:
|
||||
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:
|
||||
- "3001:3001"
|
||||
- "${BACKEND_PORT}:${BACKEND_PORT}"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
- /app/node_modules
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- ./frontend/.env
|
||||
environment:
|
||||
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:
|
||||
- "3000:3000"
|
||||
- "${FRONTEND_PORT}:${FRONTEND_PORT}"
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
|
||||
Reference in New Issue
Block a user