This is part of my Circle CI job config:
cypress-run:
working_directory: ~/abilitie/bc
docker:
- image: cimg/node:20.14.0
- image: circleci/openjdk:8-jdk
steps:
- setup_remote_docker:
version: 20.10.7
- checkout
- run:
name: Install dependencies
command: npm install
- run:
name: Install Xvfb & all Cypress dependencies
command: |
sudo apt-get update
sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- run:
name: Start Docker Compose
command: docker-compose up -d
- run:
name: Wait for MySQL to be healthy
command: |
echo "Checking MySQL logs..."
docker-compose logs mysql
echo "Waiting for MySQL to be ready..."
until docker-compose exec -T mysql mysqladmin -u *** -p*** ping --silent; do
echo "Waiting for MySQL to be ready..."
sleep 5
done
- run:
name: Wait for Websockets service to be healthy
command: |
until docker-compose exec -T websockets bash -c 'curl -f http://localhost:3000/'; do
echo "Waiting for Websockets service to be ready..."
sleep 5
done
- run:
name: Wait for Maven service to be healthy
command: |
until docker-compose exec -T maven bash -c 'curl -f http://localhost:8080/'; do
echo "Waiting for Maven service to be ready..."
sleep 5
done
- run:
name: Run Cypress tests
environment:
CYPRESS_CYPRESS_NX_APP_URL: http://localhost:8080
command: npm run cy:run
- run:
name: Shut down Docker Compose
command: docker-compose down
And this is my docker-compose.yml file:
version: '3.7'
services:
websockets:
build:
context: ./business-websocket
dockerfile: WebsocketDockerfile
ports:
- "3000:3000"
mysql:
image: mariadb:10.8.2
environment:
MYSQL_ROOT_PASSWORD: ***
MYSQL_DATABASE: ***
MYSQL_USER: ***
MYSQL_PASSWORD: ***
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
maven:
build:
dockerfile: JavaDockerfile
ports:
- "8080:8080"
depends_on:
- mysql
environment:
- CYPRESS_TESTING=e2eTest
volumes:
mysql_data:
It starts db, websockets, and Java backend and frontend.
Still, my npm run cy:run
script does not see a web app on localhost:8080.
I tried to curl -v http://localhost:8080/login
Curl it like that still it is not visible.
On the other hand when I am doing docker-compose exec -T maven bash -c 'curl -s http://localhost:8080/login'
then I see the page.
I have a feeling something is not right with networking. But in theory, exposing :8080 with docker-compose should let me access it from the host, right?
What Am I doing incorrectly?