Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 222b27c

Browse files
author
Antony MECHIN
committed
examples: Update voting app.
Signed-off-by: Antony MECHIN <antony.mechin@docker.com>
1 parent 59cd8f2 commit 222b27c

2 files changed

Lines changed: 14 additions & 81 deletions

File tree

examples/voting-app/README.md

Lines changed: 5 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
### Initialize project
44

5-
In this example, we will create an app from the existing Docker sample `example-voting-app`. First download the project [here](https://github.com/dockersamples/example-voting-app).
5+
In this example, we will create an app from the existing Docker sample `example-voting-app`. First download the `docker-stack.yml` [here](https://github.com/dockersamples/example-voting-app) ([direct link](https://raw.githubusercontent.com/dockersamples/example-voting-app/master/docker-stack.yml)
66

7-
Initialize the project using `docker-app init voting-app --compose-file example-voting-app/docker-stack.yml`.
7+
Initialize the project using `docker-app init voting-app --compose-file docker-stack.yml`.
88

99
### Edit metadata
1010

1111
Go to `voting-app.dockerapp/` and open `metadata.yml` and fill the following fields:
1212
- description
1313
- maintainers
14+
- namespace
1415

1516
### Add variables to the compose file
1617

@@ -37,7 +38,7 @@ Change default replicas, from:
3738
[voting-app.dockerapp/docker-compose.yml](voting-app.dockerapp/docker-compose.yml):
3839
```yml
3940
[...]
40-
vote:
41+
vote:
4142
image: ${vote.image.name}:${vote.image.tag}
4243
ports:
4344
- ${vote.port}:80
@@ -174,79 +175,4 @@ result:
174175

175176
### Wrap everything in a Makefile
176177

177-
Add a Makefile to simplify rendering, deploying and killing your app.
178-
179-
---
180-
181-
[voting-app.dockerapp/Makefile](voting-app.dockerapp/Makefile):
182-
```Makefile
183-
# Input.
184-
SETTINGS_DIR ?= settings
185-
APP_NAME := voting-app
186-
187-
# Output.
188-
DEVELOPMENT_DIR := build/development
189-
PRODUCTION_DIR := build/production
190-
PACK := $(APP_NAME).pack
191-
192-
#
193-
# Cleanup.
194-
#
195-
cleanup/production:
196-
@rm -rf $(PRODUCTION_DIR)
197-
198-
cleanup/development:
199-
@rm -rf $(DEVELOPMENT_DIR)
200-
201-
cleanup: cleanup/production cleanup/development
202-
203-
#
204-
# Render.
205-
#
206-
render/production: cleanup/production
207-
@mkdir -p $(PRODUCTION_DIR)
208-
docker-app render --settings-files $(SETTINGS_DIR)/production.yml > $(PRODUCTION_DIR)/docker-compose.yml
209-
210-
render/development: cleanup/development
211-
@mkdir -p $(DEVELOPMENT_DIR)
212-
docker-app render --settings-files $(SETTINGS_DIR)/development.yml > $(DEVELOPMENT_DIR)/docker-compose.yml
213-
214-
render: render/production render/development
215-
216-
#
217-
# Stop.
218-
#
219-
stop/production:
220-
docker stack rm ${APP_NAME}
221-
222-
stop/development:
223-
docker stack rm ${APP_NAME}-dev
224-
225-
stop: stop/production stop/development
226-
227-
#
228-
# Deploy.
229-
#
230-
deploy/production: render/production stop/production
231-
docker-app deploy --settings-files $(SETTINGS_DIR)/production.yml
232-
233-
deploy/development: render/development stop/development
234-
docker-app deploy --settings-files $(SETTINGS_DIR)/development.yml
235-
236-
#
237-
# Pack.
238-
#
239-
pack:
240-
docker-app pack -o $(PACK)
241-
242-
#
243-
# Helm.
244-
#
245-
helm/production:
246-
docker-app helm --settings-files $(SETTINGS_DIR)/production.yml
247-
248-
helm/development:
249-
docker-app helm --settings-files $(SETTINGS_DIR)/development.yml
250-
```
251-
252-
You can add more commands, depending on your needs.
178+
Add a Makefile to simplify rendering, deploying and killing your app, see [voting-app.dockerapp/Makefile](voting-app.dockerapp/Makefile).
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
# Version of the application
12
version: 0.1.0
3+
# Name of the application
24
name: voting-app
5+
# A short description of the application
36
description: "Dogs or cats?"
7+
# Namespace to use when pushing to a registry. This is typically your Hub username.
8+
namespace: myHubUsername
9+
# List of application maitainers with name and email for each
410
maintainers:
5-
- name: dimrok
6-
email: "antony.mechin@docker.com"
11+
- name: user
12+
email: user@email.com
13+
# Specify false here if your application doesn't support Swarm or Kubernetes
714
targets:
815
swarm: true
916
kubernetes: true

0 commit comments

Comments
 (0)