本番デプロイ用設定ファイルを追加

- backend/Dockerfile.prod: gunicorn で起動する本番用 Dockerfile
- frontend/Dockerfile.prod: マルチステージビルドの本番用 Dockerfile
- docker-compose.prod.yml: Traefik 連携・本番用 compose 設定
  - main.keinafarm.net でフロントエンド・バックエンドを公開
  - /api/ はバックエンド(priority=10)、それ以外はフロントエンド(priority=5)
- .env.production.example: 本番環境変数のサンプル
- settings.py: ALLOWED_HOSTS・CORS_ALLOWED_ORIGINS を環境変数から設定可能に

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Akira
2026-02-24 14:32:12 +09:00
parent 7eb8505d4a
commit da2154ddca
5 changed files with 161 additions and 7 deletions

View File

@@ -20,7 +20,8 @@ SECRET_KEY = os.environ.get('SECRET_KEY', 'django-insecure-default-key')
DEBUG = os.environ.get('DEBUG', 'True') == 'True'
ALLOWED_HOSTS = ['*']
_allowed_hosts = os.environ.get('ALLOWED_HOSTS', '*')
ALLOWED_HOSTS = [h.strip() for h in _allowed_hosts.split(',')]
# Application definition
@@ -145,12 +146,16 @@ SIMPLE_JWT = {
'REFRESH_TOKEN_LIFETIME': timedelta(days=7),
}
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
"http://127.0.0.1:3000",
"http://localhost:3001",
"http://127.0.0.1:3001",
]
_cors_origins = os.environ.get('CORS_ALLOWED_ORIGINS', '')
if _cors_origins:
CORS_ALLOWED_ORIGINS = [o.strip() for o in _cors_origins.split(',')]
else:
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
"http://127.0.0.1:3000",
"http://localhost:3001",
"http://127.0.0.1:3001",
]
# メールフィルタリング機能
MAIL_API_KEY = os.environ.get('MAIL_API_KEY', '')