Skip to content

Instantly share code, notes, and snippets.

@PatricNox
Created February 11, 2020 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatricNox/ca7cd7d170d3e0dba5da7c70a74d22fe to your computer and use it in GitHub Desktop.
Save PatricNox/ca7cd7d170d3e0dba5da7c70a74d22fe to your computer and use it in GitHub Desktop.
Init script for Wordpress sites through Docker
#!/bin/sh
#
# This file needs to be executed once a new file system is imported.
# What this does, is updating project settings to have localhost as root.
#
# Dev settings & htaccess.
if [ -f "src/wp-config.php" ]; then
rm src/wp-config.php
echo '.. wp-config already exists. Removing.'
fi
cp src/wp-config.php.dev src/wp-config.php
echo '.. Dev wp-config created.'
# Incase we run init twice, don't override existing .live file
HTACCESS_FILE_LIVE=src/.htaccess.live
if [ ! -f "$HTACCESS_FILE_LIVE" ]; then
cp src/.htaccess src/.htaccess.live
cp src/.htaccess.dev src/.htaccess
echo ".. Dev htaccess created, renamed live to \".htaccess.live\""
fi
# Database adaptions.
# Tell wordpress that the site should be runned on localhost.
chmod +x ./db-init.sh ; ./db-init.sh
@PatricNox
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment