diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 6b8710a..0000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -.git diff --git a/.gitignore b/.gitignore index bdfaa66..9304b2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -demo/demo +demo_pq/demo *.swp diff --git a/demo/Dockerfile b/demo/Dockerfile deleted file mode 100644 index f5c1553..0000000 --- a/demo/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM golang:1.3-onbuild -EXPOSE 8080 diff --git a/demo/main.go b/demo/main.go deleted file mode 100644 index 6cb5852..0000000 --- a/demo/main.go +++ /dev/null @@ -1,65 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "html/template" - "log" - "net/http" - "os" -) - -var ( - mux = http.NewServeMux() - listenAddr string -) - -type ( - Content struct { - Title string - Hostname string - } -) - -func init() { - flag.StringVar(&listenAddr, "listen", ":8080", "listen address") -} - -func loadTemplate(filename string) (*template.Template, error) { - return template.ParseFiles(filename) -} - -func index(w http.ResponseWriter, r *http.Request) { - t, err := loadTemplate("templates/index.html.tmpl") - if err != nil { - fmt.Printf("error loading template: %s\n", err) - return - } - - title := os.Getenv("TITLE") - - hostname, err := os.Hostname() - if err != nil { - hostname = "unknown" - } - - cnt := &Content{ - Title: title, - Hostname: hostname, - } - - t.Execute(w, cnt) -} - -func main() { - flag.Parse() - - mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static")))) - mux.HandleFunc("/", index) - - log.Printf("listening on %s\n", listenAddr) - - if err := http.ListenAndServe(listenAddr, mux); err != nil { - fmt.Errorf("error serving: %s", err) - } -} diff --git a/demo/static/css/base.css b/demo/static/css/base.css deleted file mode 100644 index 705c9f9..0000000 --- a/demo/static/css/base.css +++ /dev/null @@ -1,23 +0,0 @@ -html, body { - background: #d7d7d7; - color: #5e5e5e; -} -.title { - font-size: 38pt; -} -.info { - font-size: 12pt; - color: #7e7e7e; -} -div.content { - margin: 2% auto 0 auto; - width: 100%; - text-align: center; -} -div.logs { - margin: 0 35% 0 35%; - width: 30%; - border: 1px solid #7a7a7a; - height: 175px; - overflow-y: scroll; -} diff --git a/demo/static/font/LigatureSymbols-2.11.eot b/demo/static/font/LigatureSymbols-2.11.eot deleted file mode 100644 index 4350e01..0000000 Binary files a/demo/static/font/LigatureSymbols-2.11.eot and /dev/null differ diff --git a/demo/static/font/LigatureSymbols-2.11.otf b/demo/static/font/LigatureSymbols-2.11.otf deleted file mode 100644 index 1926697..0000000 Binary files a/demo/static/font/LigatureSymbols-2.11.otf and /dev/null differ diff --git a/demo/static/font/LigatureSymbols-2.11.svg b/demo/static/font/LigatureSymbols-2.11.svg deleted file mode 100644 index 1133aa1..0000000 --- a/demo/static/font/LigatureSymbols-2.11.svg +++ /dev/null @@ -1,1299 +0,0 @@ - - - - - -Created by FontForge 20110222 at Thu Jan 31 03:56:08 2013 - By KazuyukiMotoyama -Created by KazuyukiMotoyama with FontForge 2.0 (http://fontforge.sf.net) OFL license - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/static/font/LigatureSymbols-2.11.ttf b/demo/static/font/LigatureSymbols-2.11.ttf deleted file mode 100644 index 0338d4c..0000000 Binary files a/demo/static/font/LigatureSymbols-2.11.ttf and /dev/null differ diff --git a/demo/static/font/LigatureSymbols-2.11.woff b/demo/static/font/LigatureSymbols-2.11.woff deleted file mode 100644 index 8a82312..0000000 Binary files a/demo/static/font/LigatureSymbols-2.11.woff and /dev/null differ diff --git a/demo/static/font/readme.md b/demo/static/font/readme.md deleted file mode 100644 index 7d1f9c6..0000000 --- a/demo/static/font/readme.md +++ /dev/null @@ -1 +0,0 @@ -This was pulled from https://github.com/docker/www.docker.io/tree/master/assets/fonts/LigatureSymbols for "official" font styles. diff --git a/demo/static/font/style.css b/demo/static/font/style.css deleted file mode 100644 index acd151f..0000000 --- a/demo/static/font/style.css +++ /dev/null @@ -1,98 +0,0 @@ -@font-face { - font-family: 'LigatureSymbols'; - src: url('LigatureSymbols-2.11.eot'); - src: url('LigatureSymbols-2.11.eot?#iefix') format('embedded-opentype'), - url('LigatureSymbols-2.11.woff') format('woff'), - url('LigatureSymbols-2.11.ttf') format('truetype'), - url('LigatureSymbols-2.11.svg#LigatureSymbols') format('svg'); - src: url('LigatureSymbols-2.11.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} - -.lsf, .lsf-icon:before { - font-family: 'LigatureSymbols'; - -webkit-text-rendering: optimizeLegibility; - -moz-text-rendering: optimizeLegibility; - -ms-text-rendering: optimizeLegibility; - -o-text-rendering: optimizeLegibility; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-font-smoothing: antialiased; - -ms-font-smoothing: antialiased; - -o-font-smoothing: antialiased; - font-smoothing: antialiased; -} - -.lsf-icon:before { - content:attr(title); - margin-right:0.3em; - font-size:130%; -} - -.lsf-icon.amazon:before { - content: '\E007'; -} - - - - - -Use by including this in your style sheet: - - - -// LigatureSymbols font kit -// ----------------------------------- // ----------------------------------- - - -@font-face { - font-family: 'LigatureSymbols'; - src: url('../fonts/LigatureSymbols/LigatureSymbols-2.11.eot'); - src: url('../fonts/LigatureSymbols/LigatureSymbols-2.11.eot?#iefix') format('embedded-opentype'), - url('../fonts/LigatureSymbols/LigatureSymbols-2.11.woff') format('woff'), - url('../fonts/LigatureSymbols/LigatureSymbols-2.11.ttf') format('truetype'), - url('../fonts/LigatureSymbols/LigatureSymbols-2.11.svg#LigatureSymbols') format('svg'); - font-weight: normal; - font-style: normal; -} - -.lsf { - font-family: 'LigatureSymbols'; - -webkit-text-rendering: optimizeLegibility; - -moz-text-rendering: optimizeLegibility; - -ms-text-rendering: optimizeLegibility; - -o-text-rendering: optimizeLegibility; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-font-smoothing: antialiased; - -ms-font-smoothing: antialiased; - -o-font-smoothing: antialiased; - font-smoothing: antialiased; - -webkit-font-feature-settings: "liga" 1, "dlig" 1; - -moz-font-feature-settings: "liga=1, dlig=1"; - -ms-font-feature-settings: "liga" 1, "dlig" 1; - -o-font-feature-settings: "liga" 1, "dlig" 1; - font-feature-settings: "liga" 1, "dlig" 1; -} -.lsf-icon:before { - content:attr(title); - margin-right:0.3em; - font-size:130%; - font-family: 'LigatureSymbols'; - -webkit-text-rendering: optimizeLegibility; - -moz-text-rendering: optimizeLegibility; - -ms-text-rendering: optimizeLegibility; - -o-text-rendering: optimizeLegibility; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-font-smoothing: antialiased; - -ms-font-smoothing: antialiased; - -o-font-smoothing: antialiased; - font-smoothing: antialiased; - -webkit-font-feature-settings: "liga" 1, "dlig" 1; - -moz-font-feature-settings: "liga=1, dlig=1"; - -ms-font-feature-settings: "liga" 1, "dlig" 1; - -o-font-feature-settings: "liga" 1, "dlig" 1; - font-feature-settings: "liga" 1, "dlig" 1; -} diff --git a/demo/static/img/docker.png b/demo/static/img/docker.png deleted file mode 120000 index 39010a9..0000000 --- a/demo/static/img/docker.png +++ /dev/null @@ -1 +0,0 @@ -docker_large.png \ No newline at end of file diff --git a/demo/static/img/docker_large.png b/demo/static/img/docker_large.png deleted file mode 100644 index 3ee003f..0000000 Binary files a/demo/static/img/docker_large.png and /dev/null differ diff --git a/demo/static/img/docker_small.png b/demo/static/img/docker_small.png deleted file mode 100644 index e69c100..0000000 Binary files a/demo/static/img/docker_small.png and /dev/null differ diff --git a/demo/templates/db.html.tmpl b/demo/templates/db.html.tmpl deleted file mode 100644 index 0a8421f..0000000 --- a/demo/templates/db.html.tmpl +++ /dev/null @@ -1,25 +0,0 @@ - - - - - {{ .Title }} - - - - - - - - -
- -

{{ .Title }}

-
- {{ range $index, $element := .Entries }} -
{{ $element.Date }}: {{ $element.Addr }}
- {{ end }} -
-

served from {{ .Hostname }}

-
- - diff --git a/demo/templates/index.html.tmpl b/demo/templates/index.html.tmpl deleted file mode 100644 index 0068842..0000000 --- a/demo/templates/index.html.tmpl +++ /dev/null @@ -1,20 +0,0 @@ - - - - - {{ .Title }} - - - - - - - - -
- -

{{ .Title }}

-

served from {{ .Hostname }}

-
- - diff --git a/demo_pq/demo b/demo_pq/demo deleted file mode 100755 index fe1edbb..0000000 Binary files a/demo_pq/demo and /dev/null differ diff --git a/demo_pq/fig.yml b/demo_pq/fig.yml deleted file mode 100644 index f46e12a..0000000 --- a/demo_pq/fig.yml +++ /dev/null @@ -1,24 +0,0 @@ -app: - build: . - entrypoint: /bin/bash - command: -c "sleep 5 && go-wrapper run" # sleep because the postgres container isn't ready on first start - environment: - - "TITLE=Docker Demo" - - "DB_USER=demo" - - "DB_PASS=demo" - - "DB_NAME=demo" - - "DB_SSL_MODE=disable" - links: - - "db:db" - ports: - - 8080 - expose: - - 8080 - -db: - image: postgres - environment: - - "POSTGRES_USER=demo" - - "POSTGRES_PASSWORD=demo" - expose: - - 5432 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ebea247 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +app: + build: demo_pq + entrypoint: /bin/bash + command: -c "sleep 5 && go-wrapper run" # sleep because the postgres container isn't ready on first start + environment: + - "TITLE=Docker Demo" + - "DB_USER=demo" + - "DB_PASS=demo" + - "DB_NAME=demo" + - "DB_SSL_MODE=disable" + links: + - "db:db" + ports: + - 8080:8080 + expose: + - 8080 + +db: + image: postgres:latest + environment: + - "POSTGRES_USER=demo" + - "POSTGRES_PASSWORD=demo" + expose: + - 5432 diff --git a/readme.md b/readme.md index 6d1bb07..c0a5449 100644 --- a/readme.md +++ b/readme.md @@ -1,17 +1,21 @@ # Docker Demo Application +Original Author: Evan Hazlett (https://github.com/ehazlett/docker-demo) + This is a Go demo application used for demonstrating Docker. # Demo -The `demo` directory contains the demo application. +The `demo_pq` directory contains the demo application. + +## Requirements -## Environment Variables +- Install Docker (https://docs.docker.com/installation/) -* `TITLE`: sets title in demo app +- Install Docker Compose (https://docs.docker.com/compose/) ## Build -`docker build -t docker-demo .` +- `docker-compose build` ## Run -`docker run -P --rm docker-demo` +- `docker-compose up`