Compare commits

...

2 Commits

Author SHA1 Message Date
rama
1b9d542542 Merge pull request 'changed sql driver and clean up' (#2) from testing into main
Reviewed-on: #2
2023-11-29 12:20:05 +01:00
Raphael Martin
01d32801e9 changed sql driver and clean up 2023-11-29 12:13:26 +01:00
3 changed files with 55 additions and 38 deletions

View File

@ -3,16 +3,14 @@
# Docker image for TYPO3 CMS # Docker image for TYPO3 CMS
FROM php:8.2-apache FROM php:8.2-apache
LABEL maintainer="Raphael Martin <raphy.martin@protonmail.ch>" LABEL maintainer="Raphael Martin <raphy.martin@protonmail.ch>"
# set envirement # set envirement
ENV LANG=de_AT ENV LANG=de_AT.UTF-8
ENV APACHE_RUN_USER a2g-www ENV APACHE_RUN_USER a2g-www
ENV TYPO3_VERSION 12.4.8 ENV TYPO3_VERSION 12.4.8
ENV TYPO3_SHA256CHECKSUM 8293b3441ec133fc8f9174fab5b88f450044ded0e188a0f12de37ad60a8bf8b3 ENV TYPO3_SHA256CHECKSUM 8293b3441ec133fc8f9174fab5b88f450044ded0e188a0f12de37ad60a8bf8b3
# change apache user # change apache user
RUN adduser --uid 1000 --gecos 'Apache User' --disabled-password $APACHE_RUN_USER \ RUN adduser --uid 1000 --gecos 'Apache User' --disabled-password $APACHE_RUN_USER \
&& chown -R "$APACHE_RUN_USER:$APACHE_RUN_USER" /var/lock/apache2 /var/run/apache2 && chown -R "$APACHE_RUN_USER:$APACHE_RUN_USER" /var/lock/apache2 /var/run/apache2
@ -26,14 +24,17 @@ RUN apt-get install -y --no-install-recommends \
locales locales
RUN export LANG=${LANG} && \ RUN export LANG=${LANG} && \
echo "${LANG}.UTF-8 UTF-8" > /etc/locale.gen && \ export LC_ALL=${LANG} && \
export LC_TIME=${LANG} && \
export LANGUAGE=${LANG} && \
echo "${LANG} UTF-8" > /etc/locale.gen && \
/usr/sbin/locale-gen /usr/sbin/locale-gen
# Export env vars # Export env vars
RUN { \ RUN { \
echo "export LC_ALL=${LANG}.UTF-8"; \ echo "export LC_ALL=${LANG}"; \
echo "export LANG=${LANG}.UTF-8"; \ echo "export LANG=${LANG}"; \
echo "export LANGUAGE=${LANG}.UTF-8"; \ echo "export LANGUAGE=${LANG}"; \
} >> ~/.bashrc } >> ~/.bashrc
RUN cp ~/.bashrc /home/${APACHE_RUN_USER} && \ RUN cp ~/.bashrc /home/${APACHE_RUN_USER} && \
@ -57,38 +58,43 @@ RUN set -ex; \
libmcrypt-dev \ libmcrypt-dev \
libpng-dev \ libpng-dev \
libpq-dev \ libpq-dev \
libzip-dev \
zlib1g-dev \ zlib1g-dev \
unzip \
zip \
sendmail \ sendmail \
graphicsmagick graphicsmagick
RUN docker-php-ext-configure gd --with-libdir=/usr/include/ --with-jpeg --with-freetype
RUN docker-php-ext-configure gd --with-libdir=/usr/include/ --with-jpeg --with-freetype && \
docker-php-ext-configure zip
RUN docker-php-ext-install -j$(nproc) \ RUN docker-php-ext-install -j$(nproc) \
pdo \
pdo_mysql \ pdo_mysql \
soap \ soap \
gd \ gd \
zip \
opcache \ opcache \
intl intl
# Clean
RUN apt-get -y purge \ RUN apt-get -y purge \
libxml2-dev libfreetype6-dev \ libxml2-dev libfreetype6-dev \
libjpeg62-turbo-dev \ libjpeg62-turbo-dev \
libmcrypt-dev \ libmcrypt-dev \
libpng-dev \ libpng-dev \
zlib1g-dev \
wget && \
apt-get autoremove -y
RUN apt-get install -y --no-install-recommends \
libzip-dev \ libzip-dev \
zlib1g-dev && \ zip
apt-get clean && \
RUN docker-php-ext-install -j$(nproc) \
zip
# Clean
RUN apt-get -y purge \
libzip-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /usr/src/* rm -rf /var/lib/apt/lists/* /usr/src/*
# Configure Apache
# Configure Apache as needed
RUN set -eux; \ RUN set -eux; \
docker-php-ext-enable opcache; \ docker-php-ext-enable opcache; \
@ -112,9 +118,7 @@ RUN { \
} > /usr/local/etc/php/conf.d/error-logging.ini } > /usr/local/etc/php/conf.d/error-logging.ini
RUN set -eux; \ RUN set -eux; \
a2enmod rewrite expires; \ a2enmod rewrite expires remoteip headers; \
\
a2enmod remoteip; \
{ \ { \
echo 'RemoteIPHeader X-Forwarded-For'; \ echo 'RemoteIPHeader X-Forwarded-For'; \
# these IP ranges are reserved for "private" use and should thus *usually* be safe inside Docker # these IP ranges are reserved for "private" use and should thus *usually* be safe inside Docker
@ -127,23 +131,20 @@ RUN set -eux; \
a2enconf remoteip; \ a2enconf remoteip; \
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' + find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +
# install TYPO3 surf # install TYPO3 surf
# RUN mkdir /usr/local/surf && \ # RUN mkdir /usr/local/surf && \
# curl -L https://github.com/TYPO3/Surf/releases/download/3.4.6/surf.phar -o /usr/local/surf/surf.phar && \ # curl -L https://github.com/TYPO3/Surf/releases/download/3.4.6/surf.phar -o /usr/local/surf/surf.phar && \
# chmod +x /usr/local/surf/surf.phar && \ # chmod +x /usr/local/surf/surf.phar && \
# ln -s /usr/local/surf/surf.phar /usr/local/bin/surf # ln -s /usr/local/surf/surf.phar /usr/local/bin/surf
# install TYPO3
RUN tar -xzf /tmp/download.tar.gz -C /var/www/ && \ RUN tar -xzf /tmp/download.tar.gz -C /var/www/ && \
rm /tmp/download* rm /tmp/download*
RUN cd /var/www/html && \ RUN cd /var/www/html && \
ln -s ../typo3_src-* typo3_src && \ ln -s ../typo3_src-* typo3_src && \
ln -s typo3_src/index.php && \ ln -s typo3_src/index.php && \
ln -s typo3_src/typo3 && \ ln -s typo3_src/typo3
touch FIRST_INSTALL
RUN chown -R $APACHE_RUN_USER:$APACHE_RUN_USER /var/www/html && \ RUN chown -R $APACHE_RUN_USER:$APACHE_RUN_USER /var/www/html && \
chown -R $APACHE_RUN_USER:$APACHE_RUN_USER /var/www/typo3_src-* && \ chown -R $APACHE_RUN_USER:$APACHE_RUN_USER /var/www/typo3_src-* && \
@ -154,6 +155,4 @@ RUN { \
echo "ServerTokens Prod"; \ echo "ServerTokens Prod"; \
} >> /etc/apache2/apache2.conf } >> /etc/apache2/apache2.conf
RUN a2enmod headers
VOLUME /var/www VOLUME /var/www

View File

@ -21,16 +21,38 @@ sample .env:
PROJECT_DATA=./data PROJECT_DATA=./data
If you want to make the first install steps uncomment following line in your docker-compose.yml in the volumes configuration from the TYPO3.
# - "./LICENSE:/var/www/html/FIRST_INSTALL:ro"
after your the installation you should comment this part again thet your ${PROJECT_DATA}/typo3conf/system/settings.php from the will not change.
the container has just sendmail installed to change this you should change the settings.php for your mail and secure for the reversproxy.
for development:
'transport_sendmail_command' => '/usr/sbin/sendmail -bs',
and append:
['SYS']['features']['security.backend.enforceReferrer'] = true
because we are behind the reverse proxy.
then execute init with then execute init with
./init ./init
use in the install wizard for the db connection "db" and the port 3306 and use pdo_mysql driver.
now the typo3 first install should be accessable: https://${PROJECT_URL} now the typo3 first install should be accessable: https://${PROJECT_URL}
if you use the sample .env: https://typo3.localhost if you use the sample .env: https://typo3.localhost
use for the db connection "db"
after the install there is at the a error. after the install there is at the a error.

View File

@ -17,13 +17,14 @@ services:
- "traefik" - "traefik"
- "default" - "default"
volumes: volumes:
- "${PROJECT_DATA}/${PROJECT_NAME}-typo3/fileadmin:/var/www/html/fileadmin" - "${PROJECT_DATA}/${PROJECT_NAME}-typo3/fileadmin:/var/www/html/fileadmin"
- "${PROJECT_DATA}/${PROJECT_NAME}-typo3/uploads:/var/www/html/uploads" - "${PROJECT_DATA}/${PROJECT_NAME}-typo3/uploads:/var/www/html/uploads"
- "${PROJECT_DATA}/${PROJECT_NAME}-typo3/protected:/var/www/protected" - "${PROJECT_DATA}/${PROJECT_NAME}-typo3/protected:/var/www/protected"
- "${PROJECT_DATA}/${PROJECT_NAME}-typo3/typo3conf:/var/www/html/typo3conf" - "${PROJECT_DATA}/${PROJECT_NAME}-typo3/typo3conf:/var/www/html/typo3conf"
- "./apache-conf/sites-enabled:/etc/apache2/sites-enabled" - "./apache-conf/sites-enabled:/etc/apache2/sites-enabled"
- "./php-conf/php.ini:/usr/local/etc/php/php.ini:ro" - "./php-conf/php.ini:/usr/local/etc/php/php.ini:ro"
## use for the first install
# - "./LICENSE:/var/www/html/FIRST_INSTALL:ro"
- "/etc/timezone:/etc/timezone:ro" - "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"
depends_on: depends_on:
@ -49,14 +50,9 @@ services:
- "--collation-server=utf8mb4_unicode_ci" - "--collation-server=utf8mb4_unicode_ci"
env_file: ".env" env_file: ".env"
volumes: volumes:
- "db:/var/lib/mysql" - "${PROJECT_DATA}/${PROJECT_NAME}-typo3/db:/var/lib/mysql"
# - "${PROJECT_DATA}/${PROJECT_NAME}-typo3/db:/var/lib/mysql"
labels: labels:
# Watchtower add to auto update # Watchtower add to auto update
- "com.centurylinklabs.watchtower.enable=true" - "com.centurylinklabs.watchtower.enable=true"
# traefik # traefik
- "traefik.enable=false" - "traefik.enable=false"
volumes:
db:
name: "${PROJECT_NAME}_db"