From 20ce169021568250335df2e8a85ed10f398e4642 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 30 Nov 2018 11:11:37 -0800 Subject: [PATCH] update helloworld example (#550) Signed-off-by: Matthew Fisher --- README.md | 48 ++++++++++++++----- examples/helloworld/cnab/Dockerfile | 9 ++-- examples/helloworld/cnab/bundle.json | 34 ------------- examples/helloworld/cnab/sigs/bundle.json.asc | 29 ----------- examples/helloworld/duffle.json | 33 +++++++++++++ examples/helloworld/duffle.toml | 24 ---------- 6 files changed, 74 insertions(+), 103 deletions(-) delete mode 100644 examples/helloworld/cnab/bundle.json delete mode 100644 examples/helloworld/cnab/sigs/bundle.json.asc create mode 100644 examples/helloworld/duffle.json delete mode 100644 examples/helloworld/duffle.toml diff --git a/README.md b/README.md index 2eae794d..f8b2148e 100644 --- a/README.md +++ b/README.md @@ -41,25 +41,49 @@ Duffle is a command line tool that allows you to install and manage CNAB bundles ```console $ duffle build ./examples/helloworld/ - Duffle Build Started: 'helloworld': 01CS02FNS3FTM9907V83GAQQMT - helloworld: Building CNAB components: SUCCESS ⚓ (1.0090s) + Step 1/5 : FROM alpine:latest + ---> 196d12cf6ab1 + Step 2/5 : RUN apk add -u bash + ---> Using cache + ---> 54b3a85c5c2e + Step 3/5 : COPY Dockerfile /cnab/Dockerfile + ---> Using cache + ---> cd6f4ff8d83d + Step 4/5 : COPY app /cnab/app + ---> 38a482447ffd + Step 5/5 : CMD ["/cnab/app/run"] + ---> Running in 8b22055f0a37 + ---> e5c795c2a1f4 + Successfully built e5c795c2a1f4 + Successfully tagged deislabs/helloworld-cnab:64dfc7c4d825fe87506dbaba6ab038eafe2a486d + ==> Successfully built bundle helloworld:0.1.0 - $ duffle credentials generate helloworld-creds -f examples/helloworld/cnab/bundle.json - name: helloworld-creds - credentials: - - name: quux - source: - value: EMPTY - destination: - path: pquux +6. Check that it was built: + ```console + $ duffle bundle list + NAME VERSION DIGEST SIGNED? + helloworld 0.1.0 b2747e5c36369f4c102f4f879caa94e607e5db7e true + ``` - $ duffle install helloworld-demo -c helloworld-creds -f examples/helloworld/cnab/bundle.json +7. Now run it: + ```console + $ duffle credentials generate helloworld-creds helloworld:0.1.0 + $ duffle install helloworld-demo -c helloworld-creds helloworld:0.1.0 Executing install action... - + hello world Install action Action install complete for helloworld-demo ``` +8. Clean up: + ```console + $ duffle uninstall helloworld-demo + Executing uninstall action... + hello world + uninstall action + Action uninstall complete for helloworld-demo + ``` + *Notes:* * Learn more about what a bundle is and its components [here](https://github.com/deislabs/cnab-spec/blob/master/100-CNAB.md). * Get a feel for what CNAB bundles look like by referencing the [bundles repo](https://github.com/deislabs/bundles) on github. diff --git a/examples/helloworld/cnab/Dockerfile b/examples/helloworld/cnab/Dockerfile index 05b9f64d..3c6b4225 100644 --- a/examples/helloworld/cnab/Dockerfile +++ b/examples/helloworld/cnab/Dockerfile @@ -1,7 +1,8 @@ FROM alpine:latest -COPY app/run /cnab/app/run -COPY bundle.json /cnab/bundle.json -COPY Dockerfile cnab/Dockerfile +RUN apk add -u bash -CMD [ "/cnab/app/run" ] \ No newline at end of file +COPY Dockerfile /cnab/Dockerfile +COPY app /cnab/app + +CMD ["/cnab/app/run"] diff --git a/examples/helloworld/cnab/bundle.json b/examples/helloworld/cnab/bundle.json deleted file mode 100644 index 05a75f4e..00000000 --- a/examples/helloworld/cnab/bundle.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "helloworld", - "version": "aa2370d945960f8cdbc086c89702ae5215106c5c", - "invocationImages": [ - { - "imageType": "docker", - "image": "microsoft/helloworld-cnab:aa2370d945960f8cdbc086c89702ae5215106c5c" - } - ], - "images": [], - "parameters": { - "hello": { - "type": "int", - "defaultValue": "1", - "allowedValues": [ - "1", - "2" - ], - "minValue": 100, - "maxValue": 200, - "minLength": 100, - "maxLength": 200, - "metadata": { - "description": "hello" - } - } - }, - "credentials": { - "quux": { - "path": "pquux", - "env": "equux" - } - } -} diff --git a/examples/helloworld/cnab/sigs/bundle.json.asc b/examples/helloworld/cnab/sigs/bundle.json.asc deleted file mode 100644 index 3ab5546b..00000000 --- a/examples/helloworld/cnab/sigs/bundle.json.asc +++ /dev/null @@ -1,29 +0,0 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA512 - -{ - "name": "foo", - "version": "1.0", - " invocationImages": [ - { - "imageType": "docker", - "image": "technosophos/helloworld:0.1.0", - "digest": "sha256:aca460afa270d4c527981ef9ca4989346c56cf9b20217dcea37df1ece8120685" - } - ], - "images": [], - "parameters": {}, - "credentials": {} -} ------BEGIN PGP SIGNATURE----- -Comment: GPGTools - https://gpgtools.org - -iQEzBAEBCgAdFiEE+yumTPTtBoSSRd/j3NX15e8yw0UFAluEHv0ACgkQ3NX15e8y -w0UyKQf/Tb/mURLiHWmw68q7cjAHx7wVgjClo34oB07uY1RCvjMiK4sXaoKC+0KO -pQOC/15HY9f2aazPHig//aqNpFyyHcpX9XjvH51CbXiNcFvIv7JgmFwr7WIUY7cS -FsaFSCS53Z5HqCQ/SYB9OU4R+uwBW/gKmP7vBGieNkEhqHQklQG9vc9zUQjuTlYp -KIW9cGd0rKWzs8wwiW9FytIM43x54sHmtXRnWxu6zNReXr32u6ZFPrfVA0yoAJQ4 -7iDhcM/VqL4j0xxfFmZuqkRCtsbgD6iUmL8VzINODGsF4lHFQrl2sKXAqMoIXyCw -ANjudClHNUNQFojriAX8YAO4V2yGVg== -=OoBW ------END PGP SIGNATURE----- diff --git a/examples/helloworld/duffle.json b/examples/helloworld/duffle.json new file mode 100644 index 00000000..8c57732b --- /dev/null +++ b/examples/helloworld/duffle.json @@ -0,0 +1,33 @@ +{ + "name": "helloworld", + "version": "0.1.0", + "description": "A short description of your bundle", + "keywords": [ + "helloworld", + "cnab", + "tutorial" + ], + "maintainers": [ + { + "name": "John Doe", + "email": "john.doe@example.com", + "url": "https://example.com" + }, + { + "name": "Jane Doe", + "email": "jane.doe@example.com", + "url": "https://example.com" + } + ], + "components": { + "cnab": { + "name": "cnab", + "builder": "docker", + "configuration": { + "registry": "deislabs" + } + } + }, + "parameters": null, + "credentials": null +} diff --git a/examples/helloworld/duffle.toml b/examples/helloworld/duffle.toml deleted file mode 100644 index 6cce4c02..00000000 --- a/examples/helloworld/duffle.toml +++ /dev/null @@ -1,24 +0,0 @@ -name = "helloworld" - -[components] - [components.cnab] - name = "cnab" - builder = "docker" - configuration = { registry = "microsoft" } - -[parameters] - [parameters.hello] - type = "int" - defaultValue = "1" - allowedValues = ["1", "2"] - minValue = 100 - maxValue = 200 - minLength = 100 - maxLength = 200 - [parameters.hello.metadata] - description = "hello" - -[credentials] - [credentials.quux] - path = "pquux" - env = "equux"