Skip to main content

tech-stack-configs

container-use環境の技術スタック別設定例とDBマイグレーションテスト手順

소스 정보

저장소
takemo101/compose-workflow
최근 소스 활동
2026년 1월 13일 01:45
감지된 SKILL.md 언어
일본어
스타
0
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
tech-stack-configs
description
container-use環境の技術スタック別設定例とDBマイグレーションテスト手順
# 技術スタック別 container-use 設定 container-use環境で各技術スタックを使用するための設定例とDBマイグレーションテスト手順。 --- ## 技術スタック別設定例 ### Node.js / TypeScript ```python config = { "base_image": "node:20-slim", "setup_commands": [ "npm ci", "npx playwright install chromium --with-deps" ], "envs": [ "NODE_ENV=test", "DATABASE_URL=postgresql://app:password@postgres:5432/testdb" ] } ``` ### Python / FastAPI ```python config = { "base_image": "python:3.11-slim", "setup_commands": [ "pip install --no-cache-dir -r requirements.txt", "pip install --no-cache-dir -r requirements-dev.txt" ], "envs": [ "PYTHONPATH=/workspace", "DATABASE_URL=postgresql://app:password@postgres:5432/testdb" ] } ``` ### Go ```python config = { "base_image": "golang:1.21-alpine", "setup_commands": [ "go mod download", "go install github.com/golang-migrate/migrate/v4/cmd/migrate@latest" ], "envs": [ "CGO_ENABLED=0", "DATABASE_URL=postgres://app:password@postgres:5432/testdb?sslmode=disable" ] } ``` ### Rust ```python config = { "base_image": "rust:1.85-slim", "setup_commands": [ "cargo fetch", "cargo build --release" ], "envs": [ "DATABASE_URL=postgres://app:password@postgres:5432/testdb" ] } ``` --- ## サービス追加例 ### PostgreSQL ```python container-use_environment_add_service( environment_source="/path/to/repo", environment_id=env_id, name="postgres", image="postgres:15-alpine", envs=[ "POSTGRES_USER=app", "POSTGRES_PASSWORD=password", "POSTGRES_DB=testdb" ], ports=[5432], explanation="Add PostgreSQL for database tests" ) ``` ### MySQL ```python container-use_environment_add_service( environment_source="/path/to/repo", environment_id=env_id, name="mysql", image="mysql:8", envs=[ "MYSQL_ROOT_PASSWORD=root", "MYSQL_DATABASE=testdb", "MYSQL_USER=app", "MYSQL_PASSWORD=password" ], ports=[3306], explanation="Add MySQL for database tests" ) ``` ### Redis ```python container-use_environment_add_service( environment_source="/path/to/repo", environment_id=env_id, name="redis", image="redis:7-alpine", ports=[6379], explanation="Add Redis for caching tests" ) ``` --- ## DBマイグレーションのテスト ### Flyway (SQL migrations) ```python # マイグレーション実行 container-use_environment_run_cmd( environment_id=env_id, environment_source="/path/to/repo", command="flyway -url=jdbc:postgresql://postgres:5432/testdb -user=app -password=password migrate", explanation="Run Flyway migrations" ) # ロールバック container-use_environment_run_cmd( environment_id=env_id, environment_source="/path/to/repo", command="flyway -url=jdbc:postgresql://postgres:5432/testdb -user=app -password=password undo", explanation="Rollback last migration" ) ``` ### Prisma (TypeScript) ```python # マイグレーション実行 container-use_environment_run_cmd( environment_id=env_id, environment_source="/path/to/repo", command="npx prisma migrate deploy", explanation="Run Prisma migrations" ) # リセット (開発用) container-use_environment_run_cmd( environment_id=env_id, environment_source="/path/to/repo", command="npx prisma migrate reset --force", explanation="Reset database and rerun migrations" ) ``` ### SQLAlchemy / Alembic (Python) ```python # マイグレーション実行 container-use_environment_run_cmd( environment_id=env_id, environment_source="/path/to/repo", command="alembic upgrade head", explanation="Run Alembic migrations" ) # ロールバック container-use_environment_run_cmd( environment_id=env_id, environment_source="/path/to/repo", command="alembic downgrade -1", explanation="Rollback one migration" ) ``` --- ## サービス起動待機 ```python # PostgreSQL起動待ち container-use_environment_run_cmd( environment_id=env_id, environment_source="/path/to/repo", command="until pg_isready -h postgres -p 5432; do sleep 1; done", explanation="Wait for PostgreSQL to be ready" ) # MySQL起動待ち container-use_environment_run_cmd( environment_id=env_id, environment_source="/path/to/repo", command="until mysqladmin ping -h mysql --silent; do sleep 1; done", explanation="Wait for MySQL to be ready" ) # Redis起動待ち container-use_environment_run_cmd( environment_id=env_id, environment_source="/path/to/repo", command="until redis-cli -h redis ping; do sleep 1; done", explanation="Wait for Redis to be ready" ) ``` --- ## ネイティブモジュール対応 一部のnpmパッケージはネイティブモジュールのビルドが必要です: ```python config = { "base_image": "node:20-slim", "setup_commands": [ "apt-get update && apt-get install -y build-essential python3", "npm ci" ] } ``` | パッケージ | 必要なパッケージ | |-----------|----------------| | `bcrypt` | `build-essential`, `python3` | | `canvas` | `libcairo2-dev`, `libpango1.0-dev` | | `sharp` | `libvips-dev` | | `sqlite3` | `build-essential`, `python3` |
GitHub에서 보기