Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile Build, Certificate Generation, and Health Check #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

InAnimaTe
Copy link
Owner

@InAnimaTe InAnimaTe commented Oct 25, 2019

This PR provides the following:

  • A multi-stage Dockerfile which builds echo-server and then ships that to the final from scratch image for execution.
  • Generation of a self-signed certificate on docker build and colocated with echo-server for SSL support.
    • PORT and SSLPORT variables define the ports to use for each.
  • Updated logging to output UserAgent.
  • Example health endpoint implementation. Future iterations will utilize something intelligent like this from Heptio!
  • Dockerfile Build with Docker Hub Registry: https://cloud.docker.com/repository/docker/inanimate/echo-server/tags
  • Removal of old un-needed files (pre-built binary and certificate keys).

Run yourself!

docker run -ti -p 80:8080 -p 443:8443 inanimate/echo-server:dockerfile-update

Health Check Example:

┌[mloria@odyssey] [dockerfile-update] 
└[~/exercise/echo-server]> httpstat -k https://localhost:443/health
Connected to 127.0.0.1:443 from 127.0.0.1:57402

HTTP/2 200 
content-type: application/json
content-length: 15
date: Fri, 25 Oct 2019 21:45:47 GMT

Body stored in: /var/folders/bm/n1j83h5n0zl89k53v41byb_80000gn/T/tmpsSHGSx

  DNS Lookup   TCP Connection   Server Processing   Content Transfer
[     4ms    |       0ms      |        2ms        |        0ms       ]
             |                |                   |                  |
    namelookup:4ms            |                   |                  |
                        connect:4ms               |                  |
                                      starttransfer:30ms             |
                                                                 total:30ms   

speed_download: 0.5 KiB/s, speed_upload: 0.0 KiB/s
┌[mloria@odyssey] [dockerfile-update] 
└[~/exercise/echo-server]> cat /var/folders/bm/n1j83h5n0zl89k53v41byb_80000gn/T/tmpsSHGSx
───────┬──────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /var/folders/bm/n1j83h5n0zl89k53v41byb_80000gn/T/tmpsSHGSx
───────┼──────────────────────────────────────────────────────────────────────────────────────────────
   1   │ {"Status":"ok"}
───────┴──────────────────────────────────────────────────────────────────────────────────────────────

And the stdout:

┌[mloria@odyssey] [dockerfile-update ⚡] 
└[~/exercise/echo-server]> docker run -ti -p 80:8080 -p 443:8443 testbuild10
Echo server listening on ssl port :8443.
Echo server listening on port :8080.
172.17.0.1:41570 | curl/7.54.0 | GET /health

@InAnimaTe InAnimaTe self-assigned this Oct 25, 2019
@InAnimaTe InAnimaTe changed the title Dockerfile Build and Certificate Generation (and Health Check!) Dockerfile Build, Certificate Generation, and Health Check Oct 25, 2019
@InAnimaTe InAnimaTe marked this pull request as ready for review October 25, 2019 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant