I have a more detailed question with more attempts here, but in summary, I have a dev docker image which runs all the services I need in order for tests to pass.
docker run -it -p 3000:3000 -p 6379:6379 -p 8983:8983 my_dockerhub/image
./start_services.sh
bundle exec rspec
# everything passes
I'd like to run these tests withing bitbucket pipelines. I tried using this container directly with this in my bitbucket-pipelines.yml:
image:
name: my_dockerhub/image
username: $DOCKER_HUB_USERNAME
password: $DOCKER_HUB_PASSWORD
email: $DOCKER_HUB_EMAIL
# bind ports here somehow?
pipelines:
branches:
'{master, develop, bitbucket_pipelines}':
- step:
name: Test
script:
- ./start_services.sh
- sleep 30
- bundle exec rspec
But I get the following error at the ```bundle exec rspec``` step
# Errno::ECONNREFUSED:
# Connection refused - connect(2) for "127.0.0.1" port 8983
How can I bind ports within the image so the tests pass?