From 505f36b0b9f7b900fc924b480ca243beab9630b6 Mon Sep 17 00:00:00 2001 From: matbgn Date: Thu, 19 May 2022 00:55:08 +0200 Subject: [PATCH] Add basic documentation to docker installation + initialize empty folders for themes and content --- Dockerfile | 17 ++++++++++++++--- docker-utils/init-server | 2 ++ readme.md | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index eff0867..21823cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,19 +10,30 @@ RUN a2enmod rewrite \ # Install PHP ext-gd RUN docker-php-ext-install gd +# Copy app content +# Use the .dockerignore file to control what ends up inside the image! WORKDIR /var/www/html COPY . . +# Install server dependencies RUN chmod +x /var/www/html/docker-utils/install-composer && \ /var/www/html/docker-utils/install-composer && \ ./composer.phar update && \ chmod +x /var/www/html/docker-utils/init-server +# Expose useful volumes (see documentation) VOLUME /var/www/html/settings -VOLUME /var/www/html/content VOLUME /var/www/html/media -VOLUME /var/www/html/themes VOLUME /var/www/html/cache -# Run the server +# Create a default copy of content and theme in case of empty directories binding +RUN mkdir -p /var/www/html/content.default/ && \ + cp -R /var/www/html/content/* /var/www/html/content.default/ && \ + mkdir -p /var/www/html/themes.default/ && \ + cp -R /var/www/html/themes/* /var/www/html/themes.default/ + +VOLUME /var/www/html/content +VOLUME /var/www/html/themes + +# Inject default values if content and themes are mounted with empty directories, adjust rights and start the server CMD ["/var/www/html/docker-utils/init-server"] \ No newline at end of file diff --git a/docker-utils/init-server b/docker-utils/init-server index c7a35b3..f3bacd9 100644 --- a/docker-utils/init-server +++ b/docker-utils/init-server @@ -1,3 +1,5 @@ #!/bin/sh +find /var/www/html/content -type d -empty -exec cp -R /var/www/html/content.default/* /var/www/html/content \; +find /var/www/html/themes -type d -empty -exec cp -R /var/www/html/themes.default/* /var/www/html/themes \; chown -R www-data:www-data /var/www/html/ apache2-foreground \ No newline at end of file diff --git a/readme.md b/readme.md index ca016fa..1634515 100644 --- a/readme.md +++ b/readme.md @@ -69,6 +69,44 @@ Make sure that the following folders and all their files are writable (permissio You can use your ftp-software for that. ### Docker installation +> :warning: This image does not provide TLS support. It's perfect either for local use or behind your own proxy, you're advised. + +Clone and edit the config.example.php you find in this repository and move it as config.php +``` +git clone git://github.com/trendschau/typemill.git +cd typemill +``` + +Build your image locally +``` +docker build -t typemill:local . +``` + +Run the docker image without persistence on port 8080 +``` +docker run -d --name typemill -p 8080:80 typemill:local +``` + +Run typemill with persistence +``` +docker run -d \ + --name=typemill \ + -p 8080:80 \ + -v $(pwd)/typemill_data/settings/:/var/www/html/settings/ \ + -v $(pwd)/typemill_data/media/:/var/www/html/media/ \ + -v $(pwd)/typemill_data/cache/:/var/www/html/cache/ \ + -v $(pwd)/typemill_data/content/:/var/www/html/content/ \ + -v $(pwd)/typemill_data/themes/:/var/www/html/themes/ \ + typemill:local +``` + +#### Volumes + +- `settings` : persists users profiles, site configuration, etc. (empty by default) +- `media` : persists media files (empty by default) +- `cache` : persists cache files for performance purpose (optional and empty by default) +- `content` : persists content published (will be initialized with default examples if the binded volume is empty) +- `themes` : persists installed themes (will be initialized with default examples if the binded volume is empty) ## Setup