Add Dockerfile

Fixes #11.
This commit is contained in:
Andrew Gaul 2017-08-25 17:53:06 -07:00
parent e505655338
commit 7a40f35b33
3 changed files with 48 additions and 0 deletions

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM ubuntu:16.04
MAINTAINER Barna Csorogi <barnacs@justletit.be>
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"]

View File

@ -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
----------

15
docker.sh Executable file
View File

@ -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