From 7a40f35b3380f1a002f053e395162bc4eb7a7935 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Fri, 25 Aug 2017 17:53:06 -0700 Subject: [PATCH] Add Dockerfile Fixes #11. --- Dockerfile | 23 +++++++++++++++++++++++ README.md | 10 ++++++++++ docker.sh | 15 +++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 Dockerfile create mode 100755 docker.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8c43337 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu:16.04 +MAINTAINER Barna Csorogi + +RUN DEBIAN_FRONTEND=noninteractive apt-get update +RUN DEBIAN_FRONTEND=noninteractive apt-get upgrade -y +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ + libjpeg8 \ + openssl \ + ssl-cert + +WORKDIR /opt/compy +COPY \ + compy \ + docker.sh \ + /opt/compy/ + +# TODO: configure HTTP BASIC authentication +# TODO: user-provided certificates +ENV \ + CERTIFICATE_DOMAIN="localhost" + +EXPOSE 9999 +ENTRYPOINT ["./docker.sh"] diff --git a/README.md b/README.md index 5c5b025..473de0a 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,16 @@ compy -host :9999 For compression, transcoding and minification options, see `compy --help` +Docker Usage +------------ + +Andrew Gaul publishes unofficial Docker images at +https://hub.docker.com/r/andrewgaul/compy/ . You can configure via: + +``` +sudo docker run --name=compy --env CERTIFICATE_DOMAIN=example.com --publish 9999:9999 andrewgaul/compy +``` + References ---------- diff --git a/docker.sh b/docker.sh new file mode 100755 index 0000000..ed2e7ad --- /dev/null +++ b/docker.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +openssl req -x509 -newkey rsa:2048 -nodes -keyout cert.key -out cert.crt -days 3650 -subj "/CN=${CERTIFICATE_DOMAIN}" +openssl req -x509 -newkey rsa:2048 -nodes -keyout ca.key -out ca.crt -days 3650 -subj "/CN=${CERTIFICATE_DOMAIN}" + +echo 'Generated server certificate:' +cat cert.crt +echo +echo 'Generated CA certificate:' +cat ca.crt + +exec ./compy \ + -cert cert.crt -key cert.key \ + -ca ca.crt -cakey ca.key \ + :9999