Dockerfile, based on the README installation steps

This commit is contained in:
Robin Whittleton 2021-02-01 21:23:58 +01:00 committed by Alex Cabal
parent 8f30ee2530
commit 0ffcb889e9
3 changed files with 51 additions and 0 deletions

25
Dockerfile Normal file
View file

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

View file

@ -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. 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 its a self-signed certificate youll need to accept whatever browser security warnings come up.
# Filesystem layout # 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. - `/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.

10
scripts/docker/start-server.sh Executable file
View file

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