Skip to content

Commit

Permalink
Adjust docker build (#13)
Browse files Browse the repository at this point in the history
* Adjust typo3 wrapper script

* Adjust Dockerfile

Signed-off-by: Kim Oliver Drechsel <[email protected]>

---------

Signed-off-by: Kim Oliver Drechsel <[email protected]>
  • Loading branch information
kimdre committed Jun 10, 2024
1 parent afdd3a1 commit 4034b25
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 262 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ The TYPO3 CLI tool can be run with the command [`typo3`](src/scripts/typo3) and
### General

- `TZ`: Default: `UTC` Timezone inside the container, e.g. "Europe/Berlin"
- `DOMAIN`: Default `-` Domain name of the Website, e.g. "domain.com"
- `LOCALE`: Default: `en_US` Set a UTF-8 compatible localisation
- `LOG_LEVEL`: Default: `warn` [Log level](#log-levels) of the Apache web server

Expand Down
76 changes: 49 additions & 27 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,45 +39,65 @@ ENV TZ=UTC \

WORKDIR $WEB_ROOT

RUN apt-get update && \
# Configure PHP
RUN savedAptMark="$(apt-mark showmanual)" && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
# Configure PHP
libxml2-dev libfreetype6-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
libtool \
libxml2-dev \
libjpeg-dev \
libmcrypt-dev \
libpng-dev \
libpq-dev \
libicu-dev \
libyaml-dev \
libzip-dev \
zlib1g-dev \
# Install required 3rd party tools
graphicsmagick ghostscript locales unzip && \
sed -i "s/^# *\(${LOCALE}.UTF-8\)/\1/" /etc/locale.gen && \
locale-gen && \
# Configure extensions \
pecl install redis && \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/* && \
export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" && \
pecl install apcu yaml && \
docker-php-ext-configure intl --enable-intl && \
docker-php-ext-configure gd --with-libdir=/usr/include/ --with-jpeg --with-freetype && \
docker-php-ext-install -j$(nproc) soap gd zip opcache intl pgsql pdo pdo_pgsql pdo_mysql mysqli exif && \
docker-php-ext-enable redis && \
# Configure Apache as needed
a2enmod rewrite && \
docker-php-ext-install -j$(nproc) soap gd zip opcache intl pdo pdo_pgsql pdo_mysql mysqli exif && \
docker-php-ext-enable apcu yaml && \
echo "ServerName localhost" >> /etc/apache2/apache2.conf && \
apt-get clean && \
apt-get -y purge --auto-remove \
libxml2-dev libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libzip-dev \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/* /usr/src/php.tar.xz*
apt-mark auto '.*' > /dev/null && \
apt-mark manual $savedAptMark && \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $PHPIZE_DEPS && \
#mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
rm -rf /usr/src/php.tar.xz*

ADD https://get.typo3.org/${TYPO3_VERSION}/tar.gz typo3_src-${TYPO3_VERSION}
# Install required 3rd party tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
imagemagick \
ghostscript \
locales \
unzip \
supervisor \
libzip4 \
libyaml-0-2 \
cron && \
rm -rf /var/lib/apt/lists/* && \
sed -i "s/^# *\(${LOCALE}.UTF-8\)/\1/" /etc/locale.gen && \
locale-gen

RUN a2enmod rewrite expires headers

# Add recommended opcache settings from https://secure.php.net/manual/en/opcache.installation.php
COPY configs/opcache-recommended.ini /usr/local/etc/php/conf.d/opcache-recommended.ini
COPY configs/typo3-php.ini /usr/local/etc/php/conf.d/typo3.ini
COPY configs/supervisord.conf /etc/supervisor/supervisord.conf

COPY configs/php.ini /usr/local/etc/php/conf.d/typo3.ini
COPY docker-entrypoint.sh /docker-entrypoint.sh
COPY docker-entrypoint.d /docker-entrypoint.d
COPY scripts/typo3 /usr/bin/typo3

ADD https://get.typo3.org/${TYPO3_VERSION}/tar.gz typo3_src-${TYPO3_VERSION}

# Copy composer binary to this image
#COPY --from=composer/composer:latest-bin /composer /usr/local/bin/composer

Expand All @@ -98,7 +118,9 @@ RUN tar -xzf typo3_src-${TYPO3_VERSION} && \
mkdir -p ${WEB_ROOT}/typo3conf/ext/ && \
unzip typo3_console.zip -d ${WEB_ROOT}/typo3conf/ext/typo3_console/ && \
rm typo3_console.zip && \
php typo3conf/ext/typo3_console/activate
php typo3conf/ext/typo3_console/activate && \
echo "*/5 * * * * /usr/local/bin/php ${WEB_ROOT}/typo3/sysext/core/bin/typo3 scheduler:run" > /var/spool/cron/crontabs/www-data && \
chmod 600 /var/spool/cron/crontabs/www-data


VOLUME ${WEB_ROOT}/fileadmin
Expand All @@ -112,4 +134,4 @@ EXPOSE 80
STOPSIGNAL SIGWINCH

ENTRYPOINT ["bash", "/docker-entrypoint.sh"]
CMD ["apache2-foreground"]
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
226 changes: 0 additions & 226 deletions src/configs/apache2.conf

This file was deleted.

24 changes: 24 additions & 0 deletions src/configs/opcache-recommended.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; PHP Opcache settings from https://secure.php.net/manual/en/opcache.installation.php ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Determines if Zend OPCache is enabled
opcache.enable=1

; The OPcache shared memory storage size.
opcache.memory_consumption=128;

; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=8

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 100000 are allowed.
opcache.max_accelerated_files=4000

; How often (in seconds) to check file timestamps for changes to the shared
; memory storage allocation. ("1" means validate once per second, but only
; once per request. "0" means always validate)
opcache.revalidate_freq=2

; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=1
7 changes: 0 additions & 7 deletions src/configs/php.ini

This file was deleted.

Loading

0 comments on commit 4034b25

Please sign in to comment.