Fix key generation in Docker

We were generating the key in the Dockerfile, but then mounting the host’s web directory, which “obscured” (to quote the Docker docs) the directory in the container. We can move key generation to the container entrypoint, but only call it if the key doesn’t already exist to save time on container teardown / restart.
This commit is contained in:
Robin Whittleton 2021-02-10 18:35:57 +01:00 committed by Alex Cabal
parent c36fde5c8c
commit c606dea993
2 changed files with 5 additions and 3 deletions

View file

@ -1,5 +1,9 @@
#!/bin/sh
if [ ! -f /standardebooks.org/web/config/ssl/standardebooks.test.crt ]; then
openssl req -x509 -nodes -days 99999 -newkey rsa:4096 -subj "/CN=standardebooks.test" -keyout /standardebooks.org/web/config/ssl/standardebooks.test.key -sha256 -out /standardebooks.org/web/config/ssl/standardebooks.test.crt
fi
cd /standardebooks.org/web
composer install