[DOCKER] EC-CUBE4 environment construction (local edition)

: zipper_mouth: Before

: point_right_tone1: Premise

version: '3'

services:
  web:
    image: xxxx
    container_name: container-web
    working_dir: /var/www/vhosts/your_project/app
    volumes:
      - ../app:/var/www/vhosts/your_project:delegated
      - /var/www/vhosts/your_project/app/codeception
      - /var/www/vhosts/your_project/app/dockerbuild
      - /var/www/vhosts/your_project/app/gulp
      - /var/www/vhosts/your_project/app/node_modules
      - /var/www/vhosts/your_project/app/tests
      - /var/www/vhosts/your_project/app/var/cache
      - /var/www/vhosts/your_project/app/var/log
      - /var/www/vhosts/your_project/app/var/sessions
      - /var/www/vhosts/your_project/app/zap
    ports:
      - '80:80'
your_workspace − your_project − docker/docker-compose.yml
                  ∟ app

: raised_hands_tone1: Steps to build a new development environment using Docker

Get the latest source code from GitHub

cd your_workspace/your_project/app
git clone -b 4.0 --depth 1 https://github.com/EC-CUBE/ec-cube.git .

Delete unnecessary files

rm -rf .git

Copying and modifying environment variable files

cp -ap .env.dist .env
vi .env

Start Docker

cd your_workspace/your_project/docker
docker-compose up -d

PHP library installation

docker-compose exec --user apache web composer install --no-scripts --no-autoloader
docker-compose exec --user apache web composer dumpautoload

EC-CUBE setup

#Change permissions and ownership of directories used for cache and log output
docker-compose exec web chown -R apache:apache ./var
docker-compose exec web chmod -R 777 ./var

# EC-CUBE initialization
docker-compose exec --user apache web ./bin/console eccube:install
# (optional)Database deletion
# bin/console doctrine:database:drop --force
#Database creation
# bin/console doctrine:database:create
# (optional)Schema deletion
# bin/console doctrine:schema:drop --force
#Schema generation
# bin/console doctrine:schema:create
#Initial data generation
# bin/console eccube:fixtures:load

EC-CUBE 4.0 Developer Document Site> Installation Method> When Using Windows Environment

Cache generation

docker-compose exec --user apache web ./bin/console cache:warmup

: point_up_tone2: When clearing the cache

docker-compose exec --user apache web ./bin/console cache:clear --no-warmup

Access confirmation

It's OK if you open http: // localhost and see the default shop. : no_entry_sign: The URL depends on the docker image you used.

: raised_hands_tone1: Procedure to build a development environment on another machine using Docker (without EC-CUBE plugin)

Prepare the source code used in the procedure "Procedure for building a new development environment"

Copying and modifying environment variable files

cd your_workspace/your_project/app
cp -ap .env.dist .env
vi .env

Start Docker

cd your_workspace/your_project/docker
docker-compose up -d

PHP library installation

docker-compose exec --user apache web composer install --no-scripts --no-autoloader
docker-compose exec --user apache web composer dumpautoload

EC-CUBE setup

#Change permissions and ownership of directories used for cache and log output
docker-compose exec web chown -R apache:apache ./var
docker-compose exec web chmod -R 777 ./var

# EC-CUBE initialization
docker-compose exec --user apache web ./bin/console eccube:install

Cache generation

docker-compose exec --user apache web ./bin/console cache:warmup

: point_up_tone2: When clearing the cache

docker-compose exec --user apache web ./bin/console cache:clear --no-warmup

Access confirmation

It's OK if you open http: // localhost and see the default shop.

: no_entry_sign: The URL depends on the docker image you used.

: raised_hands_tone1: Procedure to build a development environment on another machine using Docker (with EC-CUBE plugin)

Prepare the source code used in the procedure "Procedure for building a new development environment".

Copying and modifying environment variable files

cd your_workspace/your_project/app
cp -ap .env.dist .env
vi .env

Start Docker

cd your_workspace/your_project/docker
docker-compose up -d

PHP library installation

If you have the EC-CUBE plug-in installed, you can find information about the EC-CUBE plug-in in composer.json and composer.lock. The sales aggregation plugin is ec-cube/SalesReport4. You can't do composer install as it is ...: sob:

To avoid this, prepare the original composer.json and composer.lock of the EC-CUBE version you are using and execute the command.

docker-compose exec --user apache -e COMPOSER=composer_4.0.5.json web composer install --no-scripts --no-autoloader
docker-compose exec --user apache web composer dumpautoload

EC-CUBE setup

#Change permissions and ownership of directories used for cache and log output
docker-compose exec web chown -R apache:apache ./var
docker-compose exec web chmod -R 777 ./var

# EC-CUBE initialization
docker-compose exec --user apache web ./bin/console eccube:install

Set authentication key

In my case, the authentication key is prepared for each case (development environment, staging environment, production environment are the same), so set the authentication key obtained in the environment installed first here.

update dtb_base_info set authentication_key='your_authentication_key';

Installation of EC-CUBE plug-in

docker-compose exec --user apache web ./bin/console eccube:composer:install

There is also another command, ./bin/console eccube: composer: require-already-installed. Since it is require, there is a possibility that a version different from composer.lock will be included, so I did not use it here. eccube: composer: install does not refer to the dtb_plugin table, and eccube: composer: require-already-installed refers to the dtb_plugin table. There seems to be a difference.

Enabling the EC-CUBE plug-in

docker-compose exec --user apache web ./bin/console eccube:plugin:enable --code=SalesReport4

Cache generation

docker-compose exec --user apache web ./bin/console cache:warmup

: point_up_tone2: When clearing the cache

docker-compose exec --user apache web ./bin/console cache:clear --no-warmup

Access confirmation

It's OK if you open http: // localhost and see the default shop.

: no_entry_sign: The URL depends on the docker image you used.

Reference link

Recommended Posts

EC-CUBE4 environment construction (local edition)
Offline environment construction Ruby edition
Offline environment construction CentOS edition
[Environment construction] Uninstall rails from local
[Java] Environment construction
Java environment construction
[Spring] Environment construction
Docker environment construction
Docker + DynamoDB local + C ++ environment construction and practice
Wordpress local environment construction & development procedure with Docker
Penronse environment construction [Windows]
[Environment construction] Eclipse installation
[Flutter] Ubuntu 20.04 environment construction
Rails Docker environment construction
Circle CI environment construction
java development environment construction
Rails6 development environment construction [Mac]
[Spring Boot] Environment construction (macOS)
Rails engineer environment construction ruby2.7.1
I tried node-jt400 (Environment construction)
Rails environment construction Rails5.2.1 ruby2.5.1 Catalina
MySQL 5.7 (Docker) environment construction memo
Introduction to Metabase ~ Environment Construction ~
JavaFX environment construction in Java 13
Redmine (Docker) environment construction memo
[Docker] Rails 5.2 environment construction with docker
AtCoder Challenge Environment Construction (Java 8)
Docker × Spring Boot environment construction
[Super easy] Ruby environment construction
[Rails / MySQL] Mac environment construction
[Docker] postgres, pgadmin4 environment construction
Laravel environment construction (Ubuntu 18.04 LTS)
React environment construction with Docker
[Windows] WSL2 + Ubuntu + Node.js environment construction
Node.js environment construction with Docker Compose
Build Couchbase local environment with Docker
◆ Spring Boot + gradle environment construction memo
Environment construction for Servlet application development
Environment construction with Docker for beginners
Ruby environment construction summary ~ mac version ~
Laravel + Docker Laradock usage environment construction
[Unity] Android development environment construction procedure
Make a language! (JavaCC environment construction)
Ruby on Rails 6.0 environment construction memo
Rails on Docker environment construction procedure
[Environment construction with Docker] Rails 6 & MySQL 8
CentOS8 + Anaconda 4.9.2 + jupyterhub environment construction procedure
[Java & SpringBoot] Environment Construction for Mac
Troublesome Rails environment construction flow [Windows 10]
[Rails] AWS EC2 instance environment construction
How to solve the local environment construction of Ruby on Rails (MAC)!