From 5dbacf780032c97daaa0d07ffe695a60ea215fe6 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 6 Jun 2024 02:52:46 +0000 Subject: [PATCH] Improve make compose-up --- templates/node-service/content/.gitignore | 5 ++--- templates/node-service/content/Makefile | 6 ++++-- templates/podinfo-example/content/.gitignore | 3 ++- templates/podinfo-example/content/Makefile | 6 ++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/templates/node-service/content/.gitignore b/templates/node-service/content/.gitignore index ff983b5..446a26c 100644 --- a/templates/node-service/content/.gitignore +++ b/templates/node-service/content/.gitignore @@ -1,4 +1,3 @@ node_modules/ -compose.yaml -values.yaml -.score-compose/ \ No newline at end of file +.score-compose/ +compose.yaml \ No newline at end of file diff --git a/templates/node-service/content/Makefile b/templates/node-service/content/Makefile index fa25efb..8beb9af 100644 --- a/templates/node-service/content/Makefile +++ b/templates/node-service/content/Makefile @@ -15,9 +15,11 @@ WORKLOAD_NAME = node-workload CONTAINER_NAME = node-service CONTAINER_IMAGE = ${CONTAINER_NAME}:test -compose.yaml: score.yaml +.score-compose/state.yaml: score-compose init \ --no-sample + +compose.yaml: score.yaml .score-compose/state.yaml Makefile score-compose generate score.yaml \ --build '${CONTAINER_NAME}={"context":".","tags":["${CONTAINER_IMAGE}"]}' \ --override-property containers.${CONTAINER_NAME}.variables.MESSAGE="Hello, Compose!" @@ -26,11 +28,11 @@ compose.yaml: score.yaml .PHONY: compose-up compose-up: compose.yaml docker compose up --build -d --remove-orphans + sleep 5 ## Generate a compose.yaml file from the score spec, launch it and test (curl) the exposed container. .PHONY: compose-test compose-test: compose-up - sleep 5 curl $$(score-compose resources get-outputs dns.default#${WORKLOAD_NAME}.dns --format '{{ .host }}:8080') ## Delete the containers running via compose down. diff --git a/templates/podinfo-example/content/.gitignore b/templates/podinfo-example/content/.gitignore index c2658d7..e3ec6e1 100644 --- a/templates/podinfo-example/content/.gitignore +++ b/templates/podinfo-example/content/.gitignore @@ -1 +1,2 @@ -node_modules/ +.score-compose/ +compose.yaml \ No newline at end of file diff --git a/templates/podinfo-example/content/Makefile b/templates/podinfo-example/content/Makefile index 1d7f08a..9f2d425 100644 --- a/templates/podinfo-example/content/Makefile +++ b/templates/podinfo-example/content/Makefile @@ -15,9 +15,11 @@ WORKLOAD_NAME = podinfo-workload CONTAINER_NAME = podinfo CONTAINER_IMAGE = ${CONTAINER_NAME}:test -compose.yaml: score.yaml +.score-compose/state.yaml: score-compose init \ --no-sample + +compose.yaml: score.yaml .score-compose/state.yaml Makefile score-compose generate score.yaml \ --build '${CONTAINER_NAME}={"context":".","tags":["${CONTAINER_IMAGE}"]}' @@ -25,11 +27,11 @@ compose.yaml: score.yaml .PHONY: compose-up compose-up: compose.yaml docker compose up --build -d --remove-orphans + sleep 5 ## Generate a compose.yaml file from the score spec, launch it and test (curl) the exposed container. .PHONY: compose-test compose-test: compose-up - sleep 5 curl $$(score-compose resources get-outputs dns.default#${WORKLOAD_NAME}.dns --format '{{ .host }}:8080') ## Delete the containers running via compose down.