Skip to content

Instantly share code, notes, and snippets.

@karlisabele
Created June 13, 2019 10:41
Show Gist options
  • Save karlisabele/16c0ccc52bdf34bee5f201ac7a0c45f7 to your computer and use it in GitHub Desktop.
Save karlisabele/16c0ccc52bdf34bee5f201ac7a0c45f7 to your computer and use it in GitHub Desktop.
WP plugins and themes pre-installed on docker image
FROM wordpress:php7.1-apache
### This is where you copy all the plugins and themes to the corresponding folders
COPY my-theme /themes/my-theme
COPY my-plugin /plugins/my-plugin
COPY entrypoint.sh /usr/bin/entrypoint
RUN chmod +x /usr/bin/entrypoint
ENV PROJECT_ROOT=/var/www/html THEME_FOLDER=/themes PLUGIN_FOLDER=/plugins
ENTRYPOINT ["entrypoint"]
CMD ["apache2-foreground"]
#!/usr/bin/env sh
set -xe
THEME_FOLDER=${THEME_FOLDER:-/themes}
PLUGIN_FOLDER=${PLUGIN_FOLDER:-/plugins}
PROJECT_ROOT=${PROJECT_ROOT:-/var/www/html}
for themeDir in `find ${THEME_FOLDER}/* -type d`
do
themeName=$(basename ${themeDir})
ln -s "$themeDir" "${PROJECT_ROOT}/wp-content/themes/$themeName"
done
for pluginDir in `find ${PLUGIN_FOLDER}/* -type d`
do
pluginName=$(basename ${pluginDir})
ln -s "$pluginDir" "${PROJECT_ROOT}/wp-content/plugins/$pluginName"
done
docker-entrypoint.sh "$@"
version: "3"
services:
php:
image: test
volumes:
- ./wordpress:/var/www/html
@YuriyBufeev
Copy link

Thank you!

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