chore(docker): add test compose fixtures
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.test
|
||||
container_name: theplug-app-test
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
MONGODB_URI: mongodb://theplug:${MONGO_INITDB_ROOT_PASSWORD}@mongodb:27017/${MONGO_DB:-theplug}?authSource=admin
|
||||
MONGODB_DB_NAME: ${MONGO_DB:-theplug}
|
||||
REDIS_URL: redis://redis:6379
|
||||
API_PORT: ${API_PORT:-3671}
|
||||
DEBUG: "true"
|
||||
depends_on:
|
||||
mongodb:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "${API_PORT:-3671}:${API_PORT:-3671}"
|
||||
volumes:
|
||||
- ./example-http-one:/root/example-http-one:ro
|
||||
- ./example-http-two:/root/example-http-two:ro
|
||||
|
||||
mongodb:
|
||||
image: mongo:8.2
|
||||
container_name: theplug-mongodb-test
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER:-theplug}
|
||||
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
|
||||
MONGO_INITDB_DATABASE: ${MONGO_DB:-theplug}
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- mongodb_test_data:/data/db
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "mongosh --quiet --username ${MONGO_USER:-theplug} --password ${MONGO_INITDB_ROOT_PASSWORD} --authenticationDatabase admin --eval \"db.adminCommand({ ping: 1 }).ok\" | grep 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
|
||||
redis:
|
||||
image: redis:8-alpine
|
||||
container_name: theplug-redis-test
|
||||
restart: unless-stopped
|
||||
command: ["redis-server", "--appendonly", "yes"]
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_test_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 5s
|
||||
|
||||
example-http-one:
|
||||
build:
|
||||
context: ./example-http-one
|
||||
container_name: theplug-example-http-one
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "18081:8080"
|
||||
|
||||
example-http-two:
|
||||
build:
|
||||
context: ./example-http-two
|
||||
container_name: theplug-example-http-two
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "18082:8080"
|
||||
|
||||
volumes:
|
||||
mongodb_test_data:
|
||||
redis_test_data:
|
||||
Reference in New Issue
Block a user