8b6432d58d
This patch optimizes the java-worker image; - Use multi-stage build to separate the build-stage from the "deploy" stage - Switch to the official Maven image, instead of manual installation of Maven. The official Maven image is also based on the `openjdk` repository on Docker Hub, which replaces the (now deprecated) `java` repository. - Use `COPY` instead of `ADD` to follow best-practice - Add `-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap` arguments so that JAVA will take memory-limits into account - Use a JRE base image for the final build-stage This change brings the size of the final image down from 184MB to 87MB Signed-off-by: Sebastiaan van Stijn <github@gone.nl> |
||
---|---|---|
.github | ||
result | ||
vote | ||
worker | ||
.gitignore | ||
architecture.png | ||
docker-compose-javaworker.yml | ||
docker-compose-simple.yml | ||
docker-compose.yml | ||
docker-stack.yml | ||
dockercloud.yml | ||
LICENSE | ||
MAINTAINERS | ||
README.md |
Example Voting App
Getting started
Download Docker. If you are on Mac or Windows, Docker Compose will be automatically installed. On Linux, make sure you have the latest version of Compose. If you're using Docker for Windows on Windows 10 pro or later, you must also switch to Linux containers.
Run in this directory:
docker-compose up
The app will be running at http://localhost:5000, and the results will be at http://localhost:5001.
Alternately, if you want to run it on a Docker Swarm, first make sure you have a swarm. If you don't, run:
docker swarm init
Once you have your swarm, in this directory run:
docker stack deploy --compose-file docker-stack.yml vote
Architecture
- A Python webapp which lets you vote between two options
- A Redis queue which collects new votes
- A .NET worker which consumes votes and stores them in…
- A Postgres database backed by a Docker volume
- A Node.js webapp which shows the results of the voting in real time
Note
The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client.