tls support
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Mauro Torrez 2019-10-02 00:04:57 -03:00
parent e8e9e57c40
commit c9676348e3

View File

@ -56,16 +56,30 @@ VOLUME /tmp/roundcube-temp
# launch and configure Unit
RUN \
# generate self-signed certificate
mkdir -p /ssl; \
openssl genpkey -algorithm RSA -out /ssl/key.pem -pkeyopt rsa_keygen_bits:4096; \
chmod 600 /ssl/key.pem; \
openssl rsa -pubout -in /ssl/key.pem -out /ssl/cert.pem; \
cat /ssl/cert.pem /ssl/key.pem > /ssl/bundle.pem; \
chmod 600 /ssl/bundle.pem; \
# create mock index files for configuring unit
[ -d /var/www/html/public_html ] || { \
mkdir -p /var/www/html/public_html /var/www/html/public_html.remove; \
}; \
[ -f /var/www/html/public_html/index.php ] || { \
touch /var/www/html/public_html/index.php /var/www/html/public_html/index.php.remove; \
}; \
unitd --control unix:/var/run/control.unit.sock \
&& curl -X PUT --data-binary \
# configure unit
unitd --control unix:/var/run/control.unit.sock; \
curl -X PUT --data-binary @/ssl/bundle.pem --unix-socket \
/var/run/control.unit.sock http://localhost/certificates/default; \
curl -X PUT --data-binary \
'{ \
"listeners": { "*:9000": { "pass": "routes" } }, \
"listeners": { \
"*:9080": { "pass": "routes" }, \
"*:9443": { "pass": "routes", "tls": { "certificates": "default" } } \
}, \
"routes": [ \
{ "match": { "uri": "/plugins/*.php" }, "action": { "pass": "applications/direct_php" } }, \
{ "match": { "uri": "/skins/*" }, "action": { "share": "/var/www/html/public_html" } }, \
@ -99,6 +113,7 @@ RUN \
rm -rf /var/www/html/public_html /var/www/html/public_html.remove; \
}
WORKDIR /var/www/html
EXPOSE 9000
ENTRYPOINT ["/docker-entrypoint.sh"]