Add local production test environment setup

- docker-compose.local.yml: 本番Dockerfile使用・Traefikなし・ポート直接公開
- deploy_local.sh: ローカル環境のビルド・起動スクリプト
- sync_db.sh: サーバーDBダンプをローカルに取り込むスクリプト
- document/20_ローカルテスト環境.md: 手順ドキュメント

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Akira
2026-04-06 13:33:28 +09:00
parent 4a1db5ef27
commit a42ccb5cda
4 changed files with 234 additions and 0 deletions

59
docker-compose.local.yml Normal file
View File

@@ -0,0 +1,59 @@
# ローカルでの本番同等テスト用
# Traefikなし、ポート直接公開、本番用Dockerfileを使用
# 使用: docker compose -f docker-compose.local.yml up -d
services:
db:
image: postgis/postgis:16-3.4
container_name: keinasystem_db
environment:
POSTGRES_DB: keinasystem
POSTGRES_USER: keinasystem
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
- "5432:5432"
volumes:
- postgres_data_local:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U keinasystem -d keinasystem"]
interval: 5s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile.prod
container_name: keinasystem_backend
environment:
DB_NAME: keinasystem
DB_USER: keinasystem
DB_PASSWORD: ${DB_PASSWORD}
DB_HOST: db
DB_PORT: 5432
SECRET_KEY: ${SECRET_KEY}
DEBUG: "False"
ALLOWED_HOSTS: localhost,127.0.0.1
CORS_ALLOWED_ORIGINS: http://localhost:3000
MAIL_API_KEY: ${MAIL_API_KEY}
FRONTEND_URL: http://localhost:3000
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.prod
args:
NEXT_PUBLIC_API_URL: http://localhost:8000
container_name: keinasystem_frontend
ports:
- "3000:3000"
depends_on:
- backend
volumes:
postgres_data_local: