diff --git a/Makefile b/Makefile index 6ae448e2..aa3b9518 100644 --- a/Makefile +++ b/Makefile @@ -120,11 +120,16 @@ publish: clean # Containers based target rules # -start: docker-compose-sdn.yml docker-compose.yml +start_recreate: docker-compose-sdn.yml docker-compose.yml docker-compose up --force-recreate --remove-orphans -d docker-compose --file $< up --force-recreate -d +start: docker-compose-sdn.yml docker-compose.yml + docker-compose up -d + docker-compose --file $< up -d + + stop: docker-compose-sdn.yml docker-compose.yml @docker-compose down --remove-orphans @@ -172,8 +177,8 @@ endif build_img: scripts/docker/Dockerfile - docker build -t networkapi:latest --file scripts/docker/Dockerfile . - docker build -t networkapi:$(NETAPI_IMAGE_VERSION) --file scripts/docker/Dockerfile . + docker build --platform=linux/x86_64 -t networkapi:latest --file scripts/docker/Dockerfile . + docker build --platform=linux/x86_64 -t networkapi:$(NETAPI_IMAGE_VERSION) --file scripts/docker/Dockerfile . push_img: scripts/docker/push_image.sh diff --git a/docker-compose.yml b/docker-compose.yml index 684108dd..c79824d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,11 +9,17 @@ services: ports: - "33306:3306" environment: - MYSQL_ROOT_PASSWORD: 'put your password here' + MYSQL_ROOT_PASSWORD: 'put_your_password_here' volumes: - netapi_db_vol:/var/lib/mysql networks: - netapi_net + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1",-p$$MYSQL_ROOT_PASSWORD ,"--silent"] + interval: 5s + timeout: 3s + retries: 2 + start_period: 15s queue: container_name: netapi_queue @@ -80,9 +86,8 @@ services: networks: - netapi_net depends_on: - - db - - queue - - cache + db: + condition: service_healthy links: - db:netapi_db external_links: diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile index 5a98a61e..4bbf628e 100644 --- a/scripts/docker/Dockerfile +++ b/scripts/docker/Dockerfile @@ -1,7 +1,7 @@ # # Base stage # -FROM alpine:3.7 as base +FROM alpine:3.7 as base RUN apk update diff --git a/scripts/docker/netapi.env b/scripts/docker/netapi.env index 4442b6f6..2f79e793 100644 --- a/scripts/docker/netapi.env +++ b/scripts/docker/netapi.env @@ -2,7 +2,7 @@ NETWORKAPI_DATABASE_NAME='networkapi' NETWORKAPI_DATABASE_USER='root' -NETWORKAPI_DATABASE_PASSWORD='put your password here' +NETWORKAPI_DATABASE_PASSWORD='put_your_password_here' NETWORKAPI_DATABASE_HOST='netapi_db'