Skip to content

Commit

Permalink
Add Apache config to Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Oliver Drechsel <[email protected]>
  • Loading branch information
kimdre committed Jun 10, 2024
1 parent 68051f0 commit 6db5a81
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
services:
typo3:
# image: typo3:latest
build:
context: src/
image: typo3:latest
# build:
# context: src/
environment:
TZ: Europe/Berlin
TYPO3_AUTO_SETUP_ENABLE: true
Expand Down
9 changes: 6 additions & 3 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ RUN savedAptMark="$(apt-mark showmanual)" && \
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 pdo pdo_pgsql pdo_mysql mysqli exif && \
docker-php-ext-install -j$(nproc) soap gd zip opcache intl pgsql pdo pdo_pgsql pdo_mysql mysqli exif && \
docker-php-ext-enable apcu yaml && \
echo "ServerName localhost" >> /etc/apache2/apache2.conf && \
apt-get clean && \
apt-mark auto '.*' > /dev/null && \
apt-mark manual $savedAptMark && \
Expand Down Expand Up @@ -91,6 +90,7 @@ RUN a2enmod rewrite expires headers
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/apache-typo3-site.conf /etc/apache2/sites-available/typo3.conf

COPY docker-entrypoint.sh /docker-entrypoint.sh
COPY docker-entrypoint.d /docker-entrypoint.d
Expand Down Expand Up @@ -120,7 +120,10 @@ RUN tar -xzf typo3_src-${TYPO3_VERSION} && \
rm typo3_console.zip && \
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
chmod 600 /var/spool/cron/crontabs/www-data && \
sed -i "s|DocumentRoot .*|DocumentRoot ${WEB_ROOT}|g" /etc/apache2/sites-available/typo3.conf && \
ln -s /etc/apache2/sites-available/typo3.conf /etc/apache2/sites-enabled/typo3.conf && \
unlink /etc/apache2/sites-enabled/000-default.conf


VOLUME ${WEB_ROOT}/fileadmin
Expand Down
30 changes: 30 additions & 0 deletions src/configs/apache-typo3-site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName localhost
UseCanonicalName On

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
4 changes: 4 additions & 0 deletions src/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

set -eo pipefail

if ! [[ "$*" =~ "supervisord" ]]; then
exec "$@"
fi

echo "Executing startup scripts..."
[ -d /docker-entrypoint.d/ ] && [ "$(ls -1 /docker-entrypoint.d/*.sh 2> /dev/null)" ] && {
chmod +x /docker-entrypoint.d/*.sh
Expand Down

0 comments on commit 6db5a81

Please sign in to comment.