From 0ffcb889e9ec951b390ce07925acc22e69071662 Mon Sep 17 00:00:00 2001 From: Robin Whittleton Date: Mon, 1 Feb 2021 21:23:58 +0100 Subject: [PATCH] Dockerfile, based on the README installation steps --- Dockerfile | 25 +++++++++++++++++++++++++ README.md | 16 ++++++++++++++++ scripts/docker/start-server.sh | 10 ++++++++++ 3 files changed, 51 insertions(+) create mode 100644 Dockerfile create mode 100755 scripts/docker/start-server.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..1e9ca35f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:20.04 + +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y composer php-fpm php-cli php-gd php-xml php-apcu php-mbstring php-intl apache2 apache2-utils libfcgi0ldbl task-spooler +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN mkdir /standardebooks.org +RUN mkdir /standardebooks.org/web +RUN mkdir /var/log/local +COPY . /standardebooks.org/web + +WORKDIR /standardebooks.org/web +RUN composer install + +RUN 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 + +RUN a2enmod headers +RUN a2enmod expires +RUN a2enmod ssl +RUN a2enmod rewrite +RUN a2enmod proxy +RUN a2enmod proxy_fcgi + +EXPOSE 443 +ENTRYPOINT ["/standardebooks.org/web/scripts/docker/start-server.sh"] diff --git a/README.md b/README.md index 950507f0..23fb9f9e 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,22 @@ git clone --bare https://github.com/standardebooks/david-lindsay_a-voyage-to-arc If everything went well, `https://standardebooks.test/ebooks/` will show the one ebook you deployed. +## Installation using Docker + +We provide a Dockerfile for testing code changes. You can build an image with: + +```shell +docker build . -t standardebooks +``` + +Then run the built image with: + +```shell +docker run -dp 443:443 standardebooks:latest +``` + +The site will now be available at `https://localhost/`, although as it’s a self-signed certificate you’ll need to accept whatever browser security warnings come up. + # Filesystem layout - `/standardebooks.org/ebooks/` contains one directory per SE ebook, arranged in a flat hierarchy. These directories look like the URL-safe identifier for the ebook, end in `.git`, and are bare Git repos; they are the “source of truth” for SE ebooks. diff --git a/scripts/docker/start-server.sh b/scripts/docker/start-server.sh new file mode 100755 index 00000000..485087f1 --- /dev/null +++ b/scripts/docker/start-server.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +ln -s /standardebooks.org/web/config/apache/standardebooks.test.conf /etc/apache2/sites-available/ +ln -s /standardebooks.org/web/config/php/fpm/standardebooks.org.ini /etc/php/*/cli/conf.d/ +ln -s /standardebooks.org/web/config/php/fpm/standardebooks.org.ini /etc/php/*/fpm/conf.d/ +ln -s /standardebooks.org/web/config/php/fpm/standardebooks.test.conf /etc/php/*/fpm/pool.d/ +a2ensite standardebooks.test +/etc/init.d/apache2 start +service php7.4-fpm restart +tail -f /var/log/apache2/error.log