Skip to content

Commit

Permalink
update docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelthq committed Oct 20, 2022
1 parent 1cc93ab commit d003025
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 36 deletions.
43 changes: 28 additions & 15 deletions circle-ci-php7.4-browsers/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
FROM cimg/php:7.4-browsers

# Install tools for Wordpress
ADD wp-tests-8.0.1.tar.gz /
RUN \
sudo mv /wp-tests /opt && \
sudo chown root:root /opt/wp-tests -R && \
curl --insecure -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
chmod +x wp-cli.phar && \
sudo mv wp-cli.phar /usr/local/bin/wp

# install php7.4-fpm
RUN sudo apt-get update && sudo apt-get install -y php7.4-fpm php7.4-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-zip php7.4-xdebug php7.4-dev php7.4-pear
# install nginx and copy ./nginx-hosts to /etc/nginx/sites-available/default
RUN sudo apt-get update && sudo apt-get install -y nginx && sudo rm -rf /etc/nginx/sites-available/default
COPY ./nginx-hosts /etc/nginx/sites-available/default
# install mariadb
RUN sudo apt-get update && sudo apt-get install -y mariadb-server mariadb-client
# setup the mariadb
RUN sudo mysql_install_db --user=mysql --ldata=/var/lib/mysql
RUN sudo service mysql start && sudo mysql -e "CREATE DATABASE wordpress;" \
&& sudo mysql -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';" \
&& sudo mysql -e "GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';" \
&& sudo mysql -e "FLUSH PRIVILEGES;"
RUN sudo apt-get update && sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb

USER circleci
# clear /var/www/html folder and install wordpress
RUN sudo rm -rf /var/www/html && sudo mkdir /var/www/html && sudo chown -R www-data:www-data /var/www/html && sudo chmod -R 755 /var/www/html
RUN sudo wp core download --path=/var/www/html --allow-root
# Download and configure Wordpress
#RUN sudo wp core download --path=/var/www/html --allow-root
RUN sudo rm -rf /var/www/html && sudo mkdir -p /var/www/html && sudo chown -R circleci:circleci /var/www/html && sudo chmod -R 755 /var/www/html
RUN wp core download --path=/var/www/html --allow-root
RUN sudo chmod -R 755 /var/www/html

# Install dockerize
ARG DOCKERIZE_VERSION=v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz

#ADD vcv-auto-authorize.php /var/www/html/wp-content/plugins/
# Define default command.
CMD ["bash"]
ADD vcv-auto-authorize.php /var/www/html/wp-content/plugins/
# run php built in server with multithreads PHP_CLI_SERVER_WORKERS=30 php -s localhost:80 -t /var/www/html
RUN sudo service mysql start && wp core config --path=/var/www/html --dbname=wordpress --dbuser=wordpress --dbpass=wordpress --dbhost=0.0.0.0 --allow-root
RUN sudo service mysql start && wp core install --path=/var/www/html --url=http://localhost --title=wordpress --admin_user=admin --admin_password=admin [email protected] --skip-email --allow-root

RUN sed -i '1i\
<?php \
#Identify the relevant protocol for the current request\
\$protocol = (!empty(\$_SERVER["HTTPS"]) && \$_SERVER["HTTPS"] !== "off" || \$_SERVER["SERVER_PORT"] == 443) ? "https" : "http";\
# Set SITEURL and HOME using a dynamic protocol.\
define("WP_SITEURL", \$protocol . "://" . \$_SERVER["HTTP_HOST"]);\
define("WP_HOME", \$protocol . "://" . \$_SERVER["HTTP_HOST"]); ?>' /var/www/html/wp-config.php

#ENV PHP_CLI_SERVER_WORKERS=30
CMD sudo service mysql start && sudo dockerize -wait tcp://localhost:3306 -timeout 60s && PHP_CLI_SERVER_WORKERS=30 php -S 0.0.0.0:80 -t /var/www/html
21 changes: 0 additions & 21 deletions circle-ci-php7.4-browsers/nginx-hosts

This file was deleted.

Binary file removed circle-ci-php7.4-browsers/wp-tests-8.0.1.tar.gz
Binary file not shown.

0 comments on commit d003025

Please sign in to comment.