Update docker_test.yml #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Docker Compose Run | |
on: | |
push: | |
branches: | |
- '**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add hosts to /etc/hosts | |
run: | | |
sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts | |
- name: start docker | |
working-directory: ./docker_run | |
run: | | |
docker compose create | |
docker compose up -d | |
sleep 10 | |
echo "waiting for docker system to start" | |
docker compose stop prometheusdbexporter | |
docker compose start | |
echo "Docker system presumably started ..." | |
- name: Check the image works fine | |
run: | | |
docker ps | |
docker cp docker_run-prometheusdbexporter-1:/usr/local/tomcat/logs ./test_container_logs | |
docker exec "docker_run-prometheusdbexporter-1" apt-get update -y | |
docker exec "docker_run-prometheusdbexporter-1" apt-get install -y iputils-ping | |
docker exec "docker_run-prometheusdbexporter-1" ping -c 4 database | |
#cat ./test_container_logs/* | |
wget -O test.prom http://localhost:8080/PrometheusDbExporter/metrics | |
cat test.prom | |
- name: stop docker | |
working-directory: ./docker_run | |
run: | | |
docker compose down | |