Skip to content

Commit

Permalink
use ci docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
tudddorrr committed Apr 27, 2024
1 parent 9bea2b1 commit 633b428
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
46 changes: 46 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3.9'

services:
test-db:
image: mysql:8
command: --default-authentication-plugin=mysql_native_password --sql_mode=
environment:
- MYSQL_DATABASE=${DB_NAME}
- MYSQL_ROOT_PASSWORD=${DB_PASS}
restart: always
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1"]
interval: 2s
timeout: 2s
retries: 10
ports:
- ${DB_PORT}:3306
volumes:
- test-data:/var/lib/mysql
networks:
- test-network

test-redis:
image: arm64v8/redis:7-alpine
command: redis-server --requirepass ${REDIS_PASSWORD}
ports:
- ${REDIS_PORT}:6379
depends_on:
test-db:
condition: service_healthy
networks:
- test-network

stripe-api:
image: stripe/stripe-mock:latest-arm64
ports:
- 12111:12111
- 12112:12112
networks:
- test-network

volumes:
test-data:

networks:
test-network:
2 changes: 1 addition & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
- test-network

stripe-api:
image: stripe/stripe-mock:latest-arm64
image: stripe/stripe-mock:latest
ports:
- 12111:12111
- 12112:12112
Expand Down
6 changes: 5 additions & 1 deletion tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

export $(cat envs/.env.test | xargs)

alias dc="docker-compose -f docker-compose.test.yml"
if [ -z "$CI" ]; then
alias dc="docker-compose -f docker-compose.test.yml"
else
alias dc="docker-compose -f docker-compose.ci.yml"
fi

trap "cleanup" EXIT

Expand Down

0 comments on commit 633b428

Please sign in to comment.