forked from bigbite/wp-cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Liam Defty
committed
Apr 15, 2020
1 parent
7932c16
commit ac20820
Showing
10 changed files
with
92 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ Desktop.ini | |
$RECYCLE.BIN/ | ||
|
||
# Project Specific | ||
Dockerfile | ||
docker-compose.yml | ||
debug.log | ||
config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM php:7.3-apache | ||
|
||
RUN apt-get update && apt-get install -y wget libpng-dev libjpeg-dev gnupg default-mysql-client nano less && rm -rf /var/lib/apt/lists/* \ | ||
&& docker-php-ext-configure gd \ | ||
&& docker-php-ext-install gd mysqli | ||
|
||
RUN a2enmod rewrite | ||
|
||
VOLUME /var/www/html | ||
|
||
RUN curl -o /bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ | ||
&& chmod +x /bin/wp \ | ||
&& wp --info --allow-root | ||
|
||
RUN set -ex; \ | ||
curl -o wordpress.tar.gz https://wordpress.org/wordpress-WP_VERSION.tar.gz; \ | ||
tar -xzf wordpress.tar.gz -C /usr/src/; \ | ||
rm wordpress.tar.gz; \ | ||
chown -R www-data:www-data /usr/src/wordpress | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["apache2-foreground"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,25 @@ | ||
#!/bin/bash | ||
set -eu | ||
if [ -f wp-config.php ]; then | ||
rm wp-config.php | ||
fi | ||
|
||
: ${WP_LOCALE:=${WP_LOCALE:-en_US}} | ||
: ${WP_ADMIN_EMAIL:=${WP_ADMIN_EMAIL:-admin@example.com}} | ||
: ${WP_DB_HOST:=db} | ||
: ${WP_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}} | ||
: ${WP_DB_PASSWORD:=''} | ||
: ${WP_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-wordpress}} | ||
user="$(id -u)" | ||
group="$(id -g)" | ||
|
||
wp core --allow-root download \ | ||
--version=${WP_VERSION} \ | ||
--force --debug | ||
if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then | ||
chown "$user:$group" . | ||
fi | ||
|
||
c=1 | ||
until mysqladmin ping -h"$WP_DB_HOST" --silent &> /dev/null | ||
do | ||
c=$((c + 1)) | ||
if [ $c -eq 60 ] | ||
then | ||
break | ||
fi | ||
sleep 2 | ||
done | ||
sourceTarArgs=( | ||
--create | ||
--file - | ||
--directory /usr/src/wordpress | ||
--owner "$user" --group "$group" | ||
) | ||
targetTarArgs=( | ||
--extract | ||
--file - | ||
) | ||
|
||
# Generate the wp-config file for debugging. | ||
wp core --allow-root config \ | ||
--dbhost="$WP_DB_HOST" \ | ||
--dbname="$WP_DB_NAME" \ | ||
--dbuser="$WP_DB_USER" \ | ||
--dbpass="$WP_DB_PASSWORD" \ | ||
--locale="$WP_LOCALE" \ | ||
--extra-php <<PHP | ||
define( 'WP_DEBUG', true ); | ||
PHP | ||
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" | ||
|
||
cat > .htaccess <<EOF | ||
# BEGIN WordPress | ||
|
@@ -55,15 +39,15 @@ EOF | |
|
||
chown "www-data:www-data" .htaccess | ||
|
||
# Create the database. | ||
wp db --allow-root create | ||
|
||
wp --allow-root core install \ | ||
--url=http://localhost \ | ||
--title="WP Cypress" \ | ||
--admin_user=admin \ | ||
--admin_password=password \ | ||
--admin_email="[email protected]" \ | ||
--skip-email \ | ||
c=1 | ||
until mysqladmin ping -h"db" --silent &> /dev/null | ||
do | ||
c=$((c + 1)) | ||
if [ $c -eq 60 ] | ||
then | ||
break | ||
fi | ||
sleep 2 | ||
done | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters