Commit 50d13d7e authored by Fabio Montefuscolo's avatar Fabio Montefuscolo

add an user to own wordpress installation and run wp-cli

parent d0ff0fc2
......@@ -5,21 +5,20 @@ RUN curl -o wp-cli.phar 'https://raw.githubusercontent.com/wp-cli/builds/gh-page
&& chmod +x wp-cli.phar \
&& mv wp-cli.phar /usr/local/bin/wp
RUN curl -o installer.php "https://getcomposer.org/installer" \
&& php installer.php --install-dir=/usr/local/bin/ --filename=composer \
&& rm installer.php
RUN wp core download --path=/var/www/html/ --version=4.5.3 --allow-root
RUN chown -R root:root /var/www/html/ \
&& chown -R www-data:www-data /var/www/html/wp-content
COPY htaccess /var/www/html/.htaccess
COPY wp-config.php /var/www/html/wp-config.php
RUN useradd --no-create-home --no-user-group --groups www-data wordpress
RUN chown -R wordpress:root /var/www/html/ \
&& chown -R wordpress:www-data /var/www/html/wp-content \
&& find /var/www/html/wp-content -type d -exec chmod 775 {} \; \
&& find /var/www/html/wp-content -type f -exec chmod 664 {} \;
RUN mkdir -p /docker-entrypoint-extra/
COPY docker-entrypoint.sh /entrypoint.sh
EXPOSE 80 443
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]
......@@ -37,7 +37,7 @@ then
gid=$(stat -c %g "$volume")
fi
if [ -n "$uid" ];
if [ -n "$uid" ] && [ "$WORDPRESS_WP_DEBUG" = "true" ];
then
user=$(awk -F: "/:$uid:[0-9]+:/{ print \$1}" /etc/passwd)
group=$(awk -F: "/:x:$gid:/{ print \$1}" /etc/group)
......@@ -49,7 +49,7 @@ then
if [ -z "$user" ];
then
usermod -u "$uid" www-data
usermod -u "$uid" wordpress
fi
else
uid=$(awk -F: '/^www-data/{ print $3 }' /etc/passwd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment