Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding initialization, build and test scripts. Modifying mysql host name on hibernate.cfg.xml. Adding healthcheck param on docker-compose. #4

Merged
merged 5 commits into from Sep 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions docker/docker-compose.yml
@@ -1,14 +1,18 @@
version: "3.1"
version: "2.1"

services:
mysql:
db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: k2j32ks4
MYSQL_ROOT_PASSWORD: k2j32ks4
ports:
- 3306:3306
volumes:
- ../db:/docker-entrypoint-initdb.d
healthcheck:
test: mysql --user=root --password=k2j32ks4 -e 'SHOW DATABASES'
timeout: 20s
retries: 10
networks:
- greatquotes

Expand All @@ -17,7 +21,7 @@ services:
ports:
- 8085:8080
depends_on:
- mysql
- db
networks:
- greatquotes

Expand All @@ -26,7 +30,8 @@ services:
ports:
- 8090:8080
depends_on:
- mysql
db:
condition: service_healthy
networks:
- greatquotes

Expand Down
8 changes: 5 additions & 3 deletions backend/test.ps1 → scripts/build.ps1
Expand Up @@ -4,10 +4,12 @@ echo "Removing all docker containers"
docker rm $(docker ps -aq)
echo "Removing all docker volumes"
docker volume rm $(docker volume ls -q)
cd ..\backend
echo "Booting docker-compose test file"
docker-compose --file ..\docker\docker-compose.yml up -d
docker-compose --file ..\src\test\resources\docker-compose.yml up -d
sleep 10
echo "Starting build and tests"
mvn clean test
mvn package
echo "Stopping all running docker containers"
docker stop $(docker ps -aq)
docker stop $(docker ps -aq)
cd ..\scripts
17 changes: 17 additions & 0 deletions scripts/build.sh
@@ -0,0 +1,17 @@
#!/bin/bash
echo "Stopping all running docker containers"
docker stop $(docker ps -aq)
echo "Removing all docker containers"
docker rm $(docker ps -aq)
echo "Removing all docker volumes"
docker volume rm $(docker volume ls -q)
cd ../backend
echo "Booting docker-compose test file"
docker-compose --file src/test/resources/docker-compose.yml up -d
sleep 10
echo "Starting build and tests"
mvn package
echo "Stopping all running docker containers"
docker stop $(docker ps -aq)
cd ../scripts

2 changes: 2 additions & 0 deletions scripts/run.ps1
@@ -0,0 +1,2 @@
echo "Booting docker-compose production file"
docker-compose --file .\docker\docker-compose.yml up --build
3 changes: 3 additions & 0 deletions scripts/run.sh
@@ -0,0 +1,3 @@
#!/bin/bash
echo "Booting docker-compose production file"
docker-compose --file ../docker/docker-compose.yml up --build