Skip to content

Commit 73648dc

Browse files
committed
Add wp-cli installation and wrapper script for WordPress CLI operations
1 parent 92bed8e commit 73648dc

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,14 @@ RUN { \
4444
echo 'max_execution_time = 300'; \
4545
} > /usr/local/etc/php/conf.d/wordpress-recommended.ini
4646

47+
# Install wp-cli for WordPress command line operations and create a wrapper script that includes --allow-root
48+
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
49+
chmod +x wp-cli.phar && \
50+
mv wp-cli.phar /usr/local/bin/wp-orig && \
51+
echo '#!/bin/bash' > /usr/local/bin/wp-cli-wrapper && \
52+
echo 'exec wp-orig --allow-root "$@"' >> /usr/local/bin/wp-cli-wrapper && \
53+
chmod +x /usr/local/bin/wp-cli-wrapper && \
54+
ln -s /usr/local/bin/wp-cli-wrapper /usr/local/bin/wp
55+
4756
EXPOSE 9000
4857
EXPOSE 9003

0 commit comments

Comments
 (0)