echo-server
echo-server copied to clipboard
Dockerfile Build, Certificate Generation, and Health Check
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
andSSLPORT
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