Commit 5f43c825 authored by Fabian Vogel's avatar Fabian Vogel

change shop version

replaced PHP 7.2 by 7.4
added composer
parent de782531
......@@ -2,7 +2,7 @@
"id": "com.oxidesales.eshop",
"title": "OXID eShop",
"author": "Fabian Vogel <fabian.vogel@oxid-esales.com>",
"description": "This is an example app",
"description": "The shop system with heart and head for your e-commerce",
"version": "0.0.1",
"healthCheckPath": "/",
"httpPort": 8000,
......
FROM composer as builder
WORKDIR /var/www/html/
RUN composer create-project --no-interaction --no-dev oxid-esales/oxideshop-project . dev-b-6.1-ce
RUN composer create-project --no-interaction --no-dev oxid-esales/oxideshop-project . dev-b-6.2-ce
RUN find . -type f -name '*.pdf' -exec rm -rf {} \;
RUN chown -R www-data:www-data /var/www/html/*
RUN chmod -R 775 /var/www/html/
......@@ -15,12 +15,20 @@ ENV OXID_DEMODATA=true
ENV APACHE_DOCUMENT_ROOT /app/data/source
# install packages
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
libcurl4-openssl-dev libfreetype6 libpng-dev libjpeg-dev libxml2-dev libwebp6 libxpm4 default-mysql-client php7.2-bcmath && \
apt-get clean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
RUN apt remove -y php* && \
add-apt-repository -y ppa:ondrej/php && apt-get update -y && \
apt-get update -y && \
apt-get install -y --no-install-recommends \
php7.4 libapache2-mod-php7.4 php7.4-bcmath php7.4-curl php7.4-gd php7.4-mysql php7.4-json php7.4-soap php7.4-xml php7.4-mbstring\
crudini apache2-dev libcurl4-openssl-dev libfreetype6 libpng-dev libjpeg-dev libxml2-dev libwebp6 libxpm4 default-mysql-client libapache2-mod-rpaf && \
apt-get clean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# install composer
RUN curl -s -o composer-setup.php https://getcomposer.org/installer \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& rm composer-setup.php
# prepare apache
RUN rm /etc/apache2/sites-enabled/* \
......@@ -35,12 +43,19 @@ RUN echo 'SetEnvIf X-Forwarded-Proto "https" HTTPS=on' >> /var/www/html/source/.
# add apache config
ADD app.conf /etc/apache2/sites-available/app.conf
RUN a2ensite app && a2enmod rewrite && a2enmod headers && a2enmod expires
RUN a2ensite app && a2enmod rewrite headers rewrite expires cache
# change session store
RUN mkdir -p /run/php/sessions && \
chown www-data:www-data /run/php/sessions && \
rm -rf /var/lib/php/sessions && ln -s /run/php/sessions /var/lib/php/sessions
# configure mod_php
RUN crudini --set /etc/php/7.4/apache2/php.ini PHP upload_max_filesize 64M && \
crudini --set /etc/php/7.4/apache2/php.ini PHP post_max_size 64M && \
crudini --set /etc/php/7.4/apache2/php.ini PHP memory_limit 128M && \
crudini --set /etc/php/7.4/apache2/php.ini Session session.save_path /run/php/sessions && \
crudini --set /etc/php/7.4/apache2/php.ini Session session.gc_probability 1 && \
crudini --set /etc/php/7.4/apache2/php.ini Session session.gc_divisor 100
# configure rpaf
RUN echo "LoadModule rpaf_module /usr/lib/apache2/modules/mod_rpaf.so" > /etc/apache2/mods-available/rpaf.load && a2enmod rpaf
COPY start.sh /app/start/
RUN chown -R www-data.www-data /app/start && chmod +x /app/start/start.sh
......
......@@ -4,14 +4,21 @@
ErrorLog "|/bin/cat"
CustomLog "|/bin/cat" combined
<Directory /app/code/source>
<Directory /app/data/source>
Options +FollowSymLinks
AllowOverride All
Require all granted
<IfModule mod_php7.c>
php_value memory_limit 64m
</IfModule>
</Directory>
<IfModule mod_rpaf.c>
RPAF_Enable On
RPAF_ProxyIPs 172.18.0.1/16
RPAF_SetHostName On
RPAF_SetHTTPS On
RPAF_SetPort On
RPAF_ForbidIfNotProxy Off
</IfModule>
</VirtualHost>
#!/bin/bash
mkdir -p /run/php/sessions
mkdir /run/apache2
chown www-data:www-data /run/php/sessions
#rm -rf /var/lib/php/sessions && ln -s /run/php/sessions /var/lib/php/sessions
cp -pr /var/www/html/* /app/data
if [[ ! -f /app/data/.initialized ]]; then
echo "Fresh installation, setting up data directory..."
# Setup commands here
# bootstrap oxid database/demodata
MYSQL_CHECKDATA=`mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} --skip-column-names -e "SHOW TABLES FROM ${CLOUDRON_MYSQL_DATABASE} LIKE 'oxconfig';"`
if [ "${MYSQL_CHECKDATA}" = "" ]
then
mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} < /app/data/source/Setup/Sql/database_schema.sql
echo "db schema created"
mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} -e "UPDATE oxshops SET OXSMTP = '${CLOUDRON_MAIL_SMTP_SERVER}:${CLOUDRON_MAIL_SMTP_PORT}', OXSMTPUSER = '', OXSMTPPWD = '' WHERE oxid = 1;"
if [ "${OXID_DEMODATA}" = true ]
then
php /app/data/vendor/bin/oe-eshop-doctrine_migration migrations:migrate
mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} < /app/data/vendor/oxid-esales/oxideshop-demodata-ce/src/demodata.sql
echo "demodata installed"
php /app/data/vendor/bin/oe-eshop-db_views_regenerate
echo "views regenerated"
rm -rf /app/data/source/Setup/
else
mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} < /app/data/source/Setup/Sql/initial_data.sql
echo "initial data imported"
php /app/data/vendor/bin/oe-eshop-doctrine_migration migrations:migrate
echo "migration done"
php /app/data/vendor/bin/oe-eshop-db_views_regenerate
if [ $? -eq 0 ];
then
cp -pr /var/www/html/* /app/data/
# bootstrap oxid database/demodata
MYSQL_CHECKDATA=`mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} --skip-column-names -e "SHOW TABLES FROM ${CLOUDRON_MYSQL_DATABASE} LIKE 'oxconfig';"`
if [ "${MYSQL_CHECKDATA}" = "" ]
then
mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} < /app/data/source/Setup/Sql/database_schema.sql
echo "db schema created"
mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} -e "UPDATE oxshops SET OXSMTP = '${CLOUDRON_MAIL_SMTP_SERVER}:${CLOUDRON_MAIL_SMTP_PORT}', OXSMTPUSER = '', OXSMTPPWD = '' WHERE oxid = 1;"
if [ "${OXID_DEMODATA}" = true ]
then
php /app/data/vendor/bin/oe-eshop-doctrine_migration migrations:migrate
mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} < /app/data/vendor/oxid-esales/oxideshop-demodata-ce/src/demodata.sql
echo "demodata installed"
php /app/data/vendor/bin/oe-eshop-db_views_regenerate
echo "views regenerated"
else
echo "views not regenerated"
fi
rm -rf /app/data/source/Setup/
fi
rm -rf /app/data/source/Setup/
else
mysql -h ${CLOUDRON_MYSQL_HOST} -u ${CLOUDRON_MYSQL_USERNAME} -p${CLOUDRON_MYSQL_PASSWORD} ${CLOUDRON_MYSQL_DATABASE} < /app/data/source/Setup/Sql/initial_data.sql
echo "initial data imported"
php /app/data/vendor/bin/oe-eshop-doctrine_migration migrations:migrate
echo "migration done"
php /app/data/vendor/bin/oe-eshop-db_views_regenerate
if [ $? -eq 0 ];
then
echo "views regenerated"
else
echo "views not regenerated"
fi
rm -rf /app/data/source/Setup/
fi
fi
chmod -R 775 /app/data/
chmod 444 /app/data/source/config.inc.php
chmod 444 /app/data/source/.htaccess
touch /app/data/.initialized
echo "Done."
fi
echo "Starting apache..."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment