Skip to content

Commit

Permalink
Add env variables directly to Dockerfile test configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Warsama-Gabriel committed Dec 10, 2024
1 parent adfc820 commit 51e759c
Showing 1 changed file with 15 additions and 29 deletions.
44 changes: 15 additions & 29 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
version: "3.7"

services:
medusa-test:
build:
context: .
dockerfile: docker/medusa/Dockerfile-test
depends_on:
- postgres
- rabbitmq
- memcached
- sunspot
- sqs-mock
- minio
ports:
- "3001:3000" # Map port 3000 of the container to port 3001 on the host
volumes:
- .:/app # Mount the current directory for live code updates
environment:
RAILS_ENV: test # Set Rails environment to test
RAILS_ENV: test
POSTGRES_DB: medusa_test
POSTGRES_USER: root
POSTGRES_PASSWORD: medusa
POSTGRES_HOST: postgres
volumes:
- .:/app
command: >
bash -c 'rm -f /app/tmp/pids/server.pid && \
/usr/local/bin/docker-entrypoint-test bundle exec rspec'
/usr/local/bin/docker-entrypoint-test bundle exec rspec
postgres:
image: postgres:12-alpine
environment:
POSTGRES_DB: medusa_test
POSTGRES_USER: root
POSTGRES_PASSWORD: medusa
volumes:
- postgres_test_data:/var/lib/postgresql/data
ports:
- "5432:5432" # Expose PostgreSQL for testing
- "5432:5432"
restart: always

rabbitmq:
image: rabbitmq
ports:
- "5672:5672" # Map RabbitMQ port
- "5672:5672"
restart: always

memcached:
Expand All @@ -52,19 +46,11 @@ services:
- "8983:8983"
restart: always

sqs-mock:
build:
context: docker/sqs-mock/.
dockerfile: Dockerfile
ports:
- "9324:9324"
restart: always

minio:
image: minio/minio
environment:
MINIO_ROOT_USER: MinioUser
MINIO_ROOT_PASSWORD: OpenSesame
MINIO_ROOT_USER: minio_user
MINIO_ROOT_PASSWORD: minio_password
command: server /data --console-address ":9001"
ports:
- "9000:9000"
Expand All @@ -74,5 +60,5 @@ services:
restart: always

volumes:
postgres_test_data:
postgres_data:
minio_data:

0 comments on commit 51e759c

Please sign in to comment.