-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
61 lines (58 loc) · 1.7 KB
/
docker-compose.test.yml
File metadata and controls
61 lines (58 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
services:
backend-test:
build:
context: ./backend
dockerfile: Dockerfile
target: test
container_name: test-book-tracker-backend
env_file:
- .env.test
depends_on:
db:
condition: service_healthy
localstack:
condition: service_healthy
volumes:
- ./backend:/app
working_dir: /app
# 起動時に結合テストを実行
command: go test -v ./test/integration/... -tags=integration
db:
image: mysql:8.0
container_name: test-book-tracker-db
environment:
MYSQL_ROOT_PASSWORD: Root12345
MYSQL_DATABASE: test_book_tracker
ports:
- "13306:3306" # テスト用にポートをずらす(内部ポートはそのまま)
volumes:
- mysql-test-data:/var/lib/mysql
- ./mysql/init:/docker-entrypoint-initdb.d # 初期化スクリプトをマウント
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-pRoot12345"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
localstack:
image: localstack/localstack:latest
container_name: test-localstack
ports:
- "14566:4566" # テスト用にポートを調整
environment:
SERVICES: "s3"
AWS_DEFAULT_REGION: ap-northeast-1
volumes:
- localstack-test-data:/var/lib/localstack
- /var/run/docker.sock:/var/run/docker.sock
- ./localstack/init-s3.test.sh:/etc/localstack/init/ready.d/init-s3.sh
- ./localstack/init-data:/init-data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
volumes:
mysql-test-data:
localstack-test-data: