From 39d21db8c7de9875ddd0971b456a1d4715139aa1 Mon Sep 17 00:00:00 2001 From: Robin Whittleton Date: Mon, 8 Feb 2021 21:35:36 +0100 Subject: [PATCH] Amend dockerfile to work with a bind mount This will mount the current directory as the code for the site in the container. --- Dockerfile | 6 ++---- README.md | 2 +- scripts/docker/start-server.sh | 3 +++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1e9ca35f..33a4ad8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,9 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN mkdir /standardebooks.org RUN mkdir /standardebooks.org/web +RUN mkdir /standardebooks.org/web/config +RUN mkdir /standardebooks.org/web/config/ssl 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 diff --git a/README.md b/README.md index 23fb9f9e..4b220293 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ docker build . -t standardebooks Then run the built image with: ```shell -docker run -dp 443:443 standardebooks:latest +docker run -dp 443:443 -v "$(pwd):/standardebooks.org/web" 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. diff --git a/scripts/docker/start-server.sh b/scripts/docker/start-server.sh index 485087f1..5edc8ec5 100755 --- a/scripts/docker/start-server.sh +++ b/scripts/docker/start-server.sh @@ -1,5 +1,8 @@ #!/bin/sh +cd /standardebooks.org/web +composer install + 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/