From dffc548c276977d0d3a78c022e9a2737b00510df Mon Sep 17 00:00:00 2001 From: Laurent Broudoux Date: Mon, 21 Aug 2023 15:22:03 +0200 Subject: [PATCH] Completing demo with devcontainers.json Signed-off-by: Laurent Broudoux --- .../.devcontainer/devcontainer.json | 30 +++++++++++++++++++ .../microcks-docker-compose.yml | 5 ++-- .../microcks-test.sh | 5 ++++ .../spring-boot-order-service/microcks.sh | 2 +- 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 shift-left-demo/spring-boot-order-service/.devcontainer/devcontainer.json create mode 100755 shift-left-demo/spring-boot-order-service/microcks-test.sh diff --git a/shift-left-demo/spring-boot-order-service/.devcontainer/devcontainer.json b/shift-left-demo/spring-boot-order-service/.devcontainer/devcontainer.json new file mode 100644 index 0000000..065f2aa --- /dev/null +++ b/shift-left-demo/spring-boot-order-service/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/java +{ + "name": "Spring Boot Order Service", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04", + + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "17", + "installMaven": "true", + "installGradle": "false" + }, + "ghcr.io/devcontainers/features/docker-in-docker:2": {} + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 9090 // The Microcks Http port onxe started with postCreateCommand + ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "docker compose -f microcks-docker-compose.yml up -d" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/shift-left-demo/spring-boot-order-service/microcks-docker-compose.yml b/shift-left-demo/spring-boot-order-service/microcks-docker-compose.yml index b6ff1eb..538afa8 100644 --- a/shift-left-demo/spring-boot-order-service/microcks-docker-compose.yml +++ b/shift-left-demo/spring-boot-order-service/microcks-docker-compose.yml @@ -5,11 +5,12 @@ services: restart: on-failure image: quay.io/microcks/microcks-cli:latest volumes: - - "./src/test/resources/third-parties:/resources" + - "./src/main/resources:/resources" + - "./src/test/resources/third-parties:/third-parties" entrypoint: - microcks-cli - import - - '/resources/apipastries-openapi.yaml:true,/resources/apipastries-postman-collection.json:false' + - '/resources/order-service-openapi.yaml:true,/third-parties/apipastries-openapi.yaml:true,/third-parties/apipastries-postman-collection.json:false' - --microcksURL=http://microcks:8080/api - --insecure - --keycloakClientId=foo diff --git a/shift-left-demo/spring-boot-order-service/microcks-test.sh b/shift-left-demo/spring-boot-order-service/microcks-test.sh new file mode 100755 index 0000000..3244709 --- /dev/null +++ b/shift-left-demo/spring-boot-order-service/microcks-test.sh @@ -0,0 +1,5 @@ +docker run -it quay.io/microcks/microcks-cli:latest microcks-cli test 'Order Service API:0.1.0' \ + http://host.docker.internal:8080/api OPEN_API_SCHEMA \ + --microcksURL=http://host.docker.internal:9090/api/ \ + --keycloakClientId=foo --keycloakClientSecret=bar --insecure --waitFor=8sec + \ No newline at end of file diff --git a/shift-left-demo/spring-boot-order-service/microcks.sh b/shift-left-demo/spring-boot-order-service/microcks.sh index 4bacc4e..3fefc8c 100755 --- a/shift-left-demo/spring-boot-order-service/microcks.sh +++ b/shift-left-demo/spring-boot-order-service/microcks.sh @@ -1 +1 @@ -docker-compose -f microcks-docker-compose.yml up \ No newline at end of file +docker compose -f microcks-docker-compose.yml up \ No newline at end of file