From bebe74ac4267e160757c462e2893f677e299ea3f Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Fri, 29 Nov 2024 18:28:26 -0300 Subject: [PATCH] chore: update docker image --- .../README.md | 44 +++++++++++ .../docker-compose.yml | 79 +++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 docker-woocommerce-php8.2-wp6.7.1-wc2.11.0-woo9.4.2/README.md create mode 100644 docker-woocommerce-php8.2-wp6.7.1-wc2.11.0-woo9.4.2/docker-compose.yml diff --git a/docker-woocommerce-php8.2-wp6.7.1-wc2.11.0-woo9.4.2/README.md b/docker-woocommerce-php8.2-wp6.7.1-wc2.11.0-woo9.4.2/README.md new file mode 100644 index 0000000..9556ca2 --- /dev/null +++ b/docker-woocommerce-php8.2-wp6.7.1-wc2.11.0-woo9.4.2/README.md @@ -0,0 +1,44 @@ +![Woocommerce](https://woocommerce.com/wp-content/themes/woo/images/logo-woocommerce@2x.png) + +# Woocommerce Docker para desarrollo + +### PHP 8.2 + WordPress 6.7.1 + WordPress Cli 2.11.0 + Mysql 5.7 + Woocommerce 9.4.2 + +### Requerimientos + +**MacOS:** + +Instalar [Docker](https://docs.docker.com/docker-for-mac/install/), [Docker-compose](https://docs.docker.com/compose/install/#install-compose) y [Docker-sync](https://github.com/EugenMayer/docker-sync/wiki/docker-sync-on-OSX). + +**Windows:** + +Instalar [Docker](https://docs.docker.com/docker-for-windows/install/), [Docker-compose](https://docs.docker.com/compose/install/#install-compose) y [Docker-sync](https://github.com/EugenMayer/docker-sync/wiki/docker-sync-on-Windows). + +**Linux:** + +Instalar [Docker](https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/) y [Docker-compose](https://docs.docker.com/compose/install/#install-compose). + +### Como usar + +De forma automática se creará una imagen WordPress y WordPress Cli, se instalará WooCommerce con el tema Storefront y se creará un producto de ejemplo. + +Para instalar Woocommerce, hacer lo siguiente y esperar 5 minutos: + +``` +docker compose up +``` + +Para Eliminar ejecutar y borrar las carpetas 'db_data' y 'wp_data': + +``` +docker compose down +``` + +### Paneles + +**Web server:** http://localhost:8000 + +**Admin:** http://localhost:8000/wp-admin + + user: admin + password: admin diff --git a/docker-woocommerce-php8.2-wp6.7.1-wc2.11.0-woo9.4.2/docker-compose.yml b/docker-woocommerce-php8.2-wp6.7.1-wc2.11.0-woo9.4.2/docker-compose.yml new file mode 100644 index 0000000..589d3a8 --- /dev/null +++ b/docker-woocommerce-php8.2-wp6.7.1-wc2.11.0-woo9.4.2/docker-compose.yml @@ -0,0 +1,79 @@ +x-common-variables: &common-variables + WORDPRESS_DB_HOST: db:3306 + WORDPRESS_DB_USER: wordpress + WORDPRESS_DB_PASSWORD: wordpress + WORDPRESS_DB_NAME: wordpress + WORDPRESS_TABLE_PREFIX: "wp_" + WORDPRESS_DEBUG: 1 + +services: + db: + platform: linux/x86_64 + image: mysql:5.7 + container_name: php8.2-wp6.7.1-wc2.11.0-woo9.4.2_mysql + ports: + - "33060:3306" + volumes: + - ./db_data:/var/lib/mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: wordpress + MYSQL_DATABASE: wordpress + MYSQL_USER: wordpress + MYSQL_PASSWORD: wordpress + wordpress: + depends_on: + - db + image: wordpress:6.7.1-php8.2-apache + container_name: php8.2-wp6.7.1-wc2.11.0-woo9.4.2_wordpress + ports: + - "8000:80" + restart: always + environment: + <<: *common-variables + volumes: + - ./wp_data:/var/www/html + wordpress-cli: + depends_on: + - db + - wordpress + image: wordpress:cli-2.11.0-php8.2 + container_name: php8.2-wp6.7.1-wc2.11.0-woo9.4.2_wordpress_cli + # vstm: This is required to run wordpress-cli with the same + # user-id as wordpress. This way there are no permission problems + # when running the cli + user: "33:33" + environment: + <<: *common-variables + # vstm: The sleep 40 is required so that the command is run after + # mysql is initialized. Depending on your machine this might take + # longer or it can go faster. + command: > + /bin/sh -c ' + sleep 40; + sed -i "s|# END WordPress|php_value upload_max_filesize 5000M \\n php_value post_max_size 5000M \\n php_value memory_limit 256M \\n php_value max_execution_time 300 \\n php_value max_input_time 300 \\n |g" /var/www/html/.htaccess; + wp core install --path="/var/www/html" --url="http://localhost:8000" --title="Transbank Store" --admin_user=admin --admin_password=admin --admin_email=transbankdevelopers@continuum.cl; + wp --allow-root plugin install woocommerce --version=9.4.2 --activate; + wp --allow-root theme install storefront --activate; + wp --allow-root wc tool run install_pages --user=admin; + wp --allow-root wc product create --name="Zapatos deportivos" --sku=1 --regular_price=1000 --status=publish --user=admin; + wp --allow-root db query "UPDATE wp_options SET option_value=\"CLP\" WHERE option_name=\"woocommerce_currency\";"; + wp --allow-root db query "UPDATE wp_options SET option_value=\"General Bustamante 24\" WHERE option_name=\"woocommerce_store_address\";"; + wp --allow-root db query "UPDATE wp_options SET option_value=\"Of M, Piso 7\" WHERE option_name=\"woocommerce_store_address_2\";"; + wp --allow-root db query "UPDATE wp_options SET option_value=\"Providencia\" WHERE option_name=\"woocommerce_store_city\";"; + wp --allow-root db query "UPDATE wp_options SET option_value=\"CL\" WHERE option_name=\"woocommerce_default_country\";"; + wp --allow-root db query "UPDATE wp_options SET option_value=\"7500000\" WHERE option_name=\"woocommerce_store_postcode\";"; + wp --allow-root db query "UPDATE wp_options SET option_value=0 WHERE option_name=\"woocommerce_price_num_decimals\";"; + wp --allow-root db query "UPDATE wp_options SET option_value=\".\" WHERE option_name=\"woocommerce_price_thousand_sep\";"; + wp --allow-root db query "UPDATE wp_options SET option_value=\",\" WHERE option_name=\"woocommerce_price_decimal_sep\";"; + wp --allow-root config set WP_DEBUG true; + wp --allow-root config set --add --type=constant WP_DEBUG_LOG true; + wp --allow-root config set --add --type=constant WP_DEBUG_DISPLAY false; + wp --allow-root config set --add --type=constant WPS_DEBUG true; + wp --allow-root config set --add --type=constant WPS_DEBUG_SCRIPTS true; + wp --allow-root config set --add --type=constant WPS_DEBUG_STYLES true; + ' + volumes_from: + - wordpress + links: + - db