1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-03 12:47:34 +02:00

Docker first non-working attempt

This commit is contained in:
matbgn
2022-05-18 21:01:19 +02:00
parent fe476e66de
commit bb84a4dcc4
8 changed files with 150 additions and 3 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 example 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

4
.gitignore vendored
View File

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

70
Dockerfile Normal file
View File

@@ -0,0 +1,70 @@
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 docker-utils /usr/local/bin
WORKDIR /src
COPY system ./system
COPY .htaccess \
composer* \
index.php \
/src/
COPY cache ./cache
COPY data ./data
COPY media ./media
COPY settings ./settings
COPY themes ./themes
RUN chmod +x /usr/local/bin/install-composer && \
/usr/local/bin/install-composer && \
./composer.phar update && \
chmod +x /usr/local/bin/init-server && \
chmod +x /usr/local/bin/adjust-rights
WORKDIR /tmp
COPY content ./content
# Create a non-root user to own the files and run our server
WORKDIR /var/www/html
# Expose single volume of data to simplify maintenance
VOLUME /var/www/html
#RUN cp -R /src/* /var/www/html/
#RUN cp -R /tmp/* /var/www/html/
#ARG UNAME=www-data
#ARG UGROUP=www-data
#ENV UID=1000
#ENV GID=1000
#RUN usermod --uid $UID $UNAME && \
# groupmod --gid $GID $UGROUP
# Install PHP dependencies
#RUN /usr/local/bin/install-composer && \
# ./composer.phar update && \
# rm -rf composer* Dockerfile docker-utils/install-composer
#
## Adjust rights for www-data, a non-root user, to own the files and run our server
#RUN /usr/local/bin/adjust-rights && \
# rm -rf Dockerfile
#RUN sed -i 's/^exec /chown www-data:www-data \/var\/www\/html/\n\nexec /' /usr/local/bin/apache2-foreground
#
### Use our non-root user
#RUN chown -R www-data:www-data /var/www/html/
#USER www-data
# Run the server
CMD ["/usr/local/bin/init-server"]

View File

@@ -0,0 +1,17 @@
#!/bin/sh
chown -R www-data:www-data /var/www/html
find /var/www/html -type d -exec chmod 570 {} \;
find /var/www/html -type f -exec chmod 460 {} \;
chown -R www-data:www-data /var/www/html/cache
find /var/www/html/cache -type d -exec chmod 770 {} \;
find /var/www/html/cache -type f -exec chmod 660 {} \;
chown -R www-data:www-data /var/www/html/content
find /var/www/html/content -type d -exec chmod 770 {} \;
find /var/www/html/content -type f -exec chmod 660 {} \;
chown -R www-data:www-data /var/www/html/media
find /var/www/html/media -type d -exec chmod 770 {} \;
find /var/www/html/media -type f -exec chmod 660 {} \;
chown -R www-data:www-data /var/www/html/settings
find /var/www/html/settings -type d -exec chmod 770 {} \;
find /var/www/html/settings -type f -exec chmod 660 {} \;

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

@@ -0,0 +1,16 @@
#!/bin/sh
find /var/www/html -type d -empty -exec cp -R /tmp/* /var/www/html/ \;
cp -R /src/* /var/www/html/
cp -R /tmp/* /var/www/html/
/usr/local/bin/install-composer && \
./composer.phar update
usermod -u $PUID www-data
groupmod -g $PGID www-data
/usr/local/bin/adjust-rights
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,9 @@ Make sure that the following folders and all their files are writable (permissio
You can use your ftp-software for that.
### Docker installation
## 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.

View File

@@ -29,7 +29,7 @@ $settings = Typemill\Settings::loadSettings();
/****************************
* HANDLE DISPLAY ERRORS *
****************************/
$settings['settings']['displayErrorDetails'] = true;
if(isset($settings['settings']['displayErrorDetails']) && $settings['settings']['displayErrorDetails'])
{
ini_set('display_errors', 1);