finish rebuild/cleanup

This commit is contained in:
Paul J Stevens 2023-09-03 12:15:16 +02:00
parent 06eb5c0199
commit 345d30f2bd
6 changed files with 31 additions and 23 deletions

View File

@ -1,17 +1,17 @@
FROM wordpress:6.1.0-php7.4-fpm
FROM wordpress:6-php7.4-fpm
COPY custom.ini $PHP_INI_DIR/conf.d/
WORKDIR /usr/src/wordpress
ENV WP_VERSION=6.1.0
ENV CIVI_VERSION=5.64.0
RUN apt-get update \
&& apt-get install -yy curl ed default-mysql-client unzip git libicu67 libicu-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
&& apt-get install -yy sudo default-mysql-client \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
USER root
RUN docker-php-ext-install intl pdo_mysql
RUN usermod -s /bin/bash www-data
RUN install -d -o www-data /var/www/.cv
RUN install -d -o www-data wp-content/uploads/civicrm/ConfigAndLog/
COPY --chmod=750 --chown=root:www-data --link scripts/* /usr/local/bin/
COPY --link wordpress/wp-content/* /var/www/html/wp-content/
COPY wordpress/wp-content/* ./wp-content/plugins/

View File

@ -33,7 +33,7 @@ reset-db:
${COMPOSE} exec --user=www-data civi /usr/local/bin/reset_db.sh
install:
${COMPOSE} exec --user=www-data civi bash -c "rm /var/www/civi/wp-content/uploads/civicrm/civicrm.settings.php; sh /usr/local/bin/install.sh"
${COMPOSE} exec --user=www-data civi /usr/local/bin/install.sh
shell:
${COMPOSE} exec civi bash

View File

@ -4,7 +4,7 @@ services:
civi:
image: civicrm:latest
volumes:
- civi-data:/var/www/html
- civi-data:/usr/src/wordpress
ports:
- 8080:80
environment:
@ -39,7 +39,7 @@ services:
- 8000:80
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
- civi-data:/var/www/html
- civi-data:/usr/src/wordpress
volumes:
db-data: ~

32
scripts/install.sh Normal file → Executable file
View File

@ -6,21 +6,28 @@ LANG=nl_NL
# wp core download --version=$WP_VERSION
BASE_DIR=/usr/src/wordpress
cd $BASE_DIR
# Set config
cp wp-config-sample.php wp-config.php
if [ -e "wp-config.php" ]; then
cp wp-config-docker.php wp-config.php
fi
wp config shuffle-salts
wp config set DB_HOST "${WORDPRESS_DB_HOST}:3306"
wp config set DB_NAME "$WORDPRESS_DB_NAME"
wp config set DB_USER "$WORDPRESS_DB_USER"
wp config set DB_PASSWORD "$WORDPRESS_DB_PASSWORD"
wp config set CIVICRM_PLUGIN_DIR "${BASE_DIR}/wp-content/plugins/civicrm/"
wp config set CIVICRM_PLUGIN_URL "https://${WORDPRESS_HOST}/wp-content/plugins/civicrm/"
# Install
wp db check
wp core install --url="$WORDPRESS_HOST" --title="$WORDPRESS_NAME" --admin_user="$WORDPRESS_ADMIN_USER" --admin_password="$WORDPRESS_ADMIN_PASSWORD" --admin_email="$WORDPRESS_ADMIN_EMAIL" --locale=$LANG --skip-email
# Install CiviCRM
PLUGIN_DIR=`pwd`/wp-content/plugins
PLUGIN_DIR=${BASE_DIR}/wp-content/plugins
# Configure CivCRM
rm -f -- wp-content/uploads/civicrm/civicrm.settings.php
@ -37,7 +44,7 @@ cp wp-content/uploads/civicrm/civicrm.settings.php wp-content/uploads/civicrm/ci
cv upgrade:db
# Install extensions
cd wp-content/uploads/civicrm/ext
cd ${BASE_DIR}/wp-content/uploads/civicrm/ext
# extensions
# built-in
@ -70,22 +77,23 @@ cv ext:enable --user="$WORDPRESS_ADMIN_USER" uk.co.vedaconsulting.mosaico
cv ext:upgrade-db --user="$WORDPRESS_ADMIN_USER"
cd /var/www/civi
cd ${BASE_DIR}
wp plugin install --activate civicrm-admin-utilities wpforms-lite wp-2fa
# remove unused
wp plugin delete akismet hello
# bug in installer?
sed -i -e 's,http://testcrm,https://testcrm,' wp-content/uploads/civicrm/civicrm.settings.php
cat >> wp-content/uploads/civicrm/civicrm.settings.php << EOF
// Disable automatic download / installation of extensions
$civicrm_setting['domain']['ext_repo_url'] = false;
$civicrm_setting['domain']['enableSSL'] = true;
EOF
# move to upgrade/post-install:
# sed -i -e 's,http://testcrm,https://testcrm,' ${BASE_DIR}/wp-content/uploads/civicrm/civicrm.settings.php
# cat >> ${BASE_DIR}/wp-content/uploads/civicrm/civicrm.settings.php << EOF
# // Disable automatic download / installation of extensions
# $civicrm_setting['domain']['ext_repo_url'] = false;
# $civicrm_setting['domain']['enableSSL'] = true;
# EOF
# make immutable
wp config set DISALLOW_FILE_MODS "true"
wp config set AUTOMATIC_UPDATER_DISABLED "true"
echo `wp option get siteurl`/wp-admin/admin.php?page=civi_options
echo "DONE!"

0
scripts/reset_db.sh Normal file → Executable file
View File

0
scripts/upgrade.sh Normal file → Executable file
View File