1
0
mirror of https://github.com/typemill/typemill.git synced 2025-01-16 21:08:20 +01:00

Merge branch 'matbgn-dev/docker'

This commit is contained in:
trendschau 2022-06-12 22:54:22 +02:00
commit 9168332b81
6 changed files with 130 additions and 2 deletions

21
.dockerignore Normal file
View File

@ -0,0 +1,21 @@
# Ignore everything
**
# Allow system files and directories
!docker-utils/
!system/
!.htaccess
!composer*
!index.php
# Allow content files and directories
!cache/
!content/
!data/
!media/
!settings/
!themes/
# Ignore unnecessary files inside allowed directories below
# This should go after the allowed directories
# e.g. docker-utils/test.php

3
.gitignore vendored
View File

@ -23,4 +23,5 @@ system/vendor
plugins/demo
zips
build.php
node_modules
node_modules
.idea

40
Dockerfile Normal file
View File

@ -0,0 +1,40 @@
FROM php:8-apache
# Install OS dependencies required
RUN apt-get update && apt-get upgrade -y && apt-get install git unzip zlib1g-dev libpng-dev -y
# Adapt apache config
RUN a2enmod rewrite \
&& echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf
# 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/media
VOLUME /var/www/html/cache
VOLUME /var/www/html/plugins
# 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"]

5
docker-utils/init-server Normal file
View File

@ -0,0 +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

View File

@ -0,0 +1,17 @@
#!/bin/sh
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT

View File

@ -41,6 +41,7 @@ Some plugin highlights are:
If you run a linux system, then please double check that mod_rewrite and htaccess are active!!!
## Installation
### Bare-metal installation
Download TYPEMILL from the [TYPEMILL website](http://typemill.net), unzip the files and you are done.
@ -56,7 +57,7 @@ If you did not use composer before, please go to the [composer website](http://g
To run TYPEMILL on a **live** system, simply upload the files to your server
## Make Folders Writable.
#### Make Folders Writable.
Make sure that the following folders and all their files are writable (permission 774 recursively):
@ -67,6 +68,49 @@ 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/plugins/:/var/www/html/plugins/ \
-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)
- `plugins` : persists installed plugins (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
If you visit your website first, then you will be redirected to the `/setup` page. Please create an initial user and configure your system in the author panel.