読み込みが終了しない場合は、しばらく待つか、リロードを行なってください。
If loading does not finish, wait for a while or reload.
エンジニア向けの情報を発信するブログです。
どなたでも発信できます。
お好きに利用していただれば幸いです。
2022-10-21追記
mac-m1でも動いたの確認しました。
2022-12-26
root/docker/docker-nginx/Dockerfileの不要な記述を削除しました(apt-get updateでエラーが発生するようになってたため)
root/docker/docker-php/Dockerfileのxdebugをインストールする記述にバージョン指定を追加しました(xdebugのlatestがphp7.xに対応していないため)
root ├── .env ├── docker │ ├── docker-nginx │ │ ├── Dockerfile │ │ └── default.conf │ └── docker-php │ ├── Dockerfile │ ├── entrypoint-dev.sh │ └── php.ini ├── docker-compose.yml └── ec-cube <- ECCUBE4.2.x ├── .env <- インストール後に勝手に作成されるので一旦スルーしてください。後半で紹介します。 ├── ...
version: "3" networks: backend: driver: bridge volumes: mysql-database: driver: local mailcatcher-data: driver: local ### ignore folder volume ##### var: driver: local vendor: driver: local services: ### ECCube4 ################################## ec-cube: build: context: . dockerfile: ./docker/docker-php/Dockerfile args: XDEBUG_INSTALL: "${XDEBUG_INSTALL:-false}" ports: - "9000:9000" - "4430:443" volumes: - "./ec-cube:/var/www/html:cached" ### 同期対象からコストの重いフォルダを除外 ##################### - "./ec-cube/var:/var/www/html/var" - "./ec-cube/vendor:/var/www/html/vendor" environment: - HOST_UID - XDEBUG_CLIENT_HOST - "XDEBUG_CLIENT_PORT=${XDEBUG_CLIENT_PORT:-9000}" - "XDEBUG_INSTALL=${XDEBUG_INSTALL:-false}" depends_on: - mysql networks: - backend web: build: ./docker/docker-nginx ports: - "${APP_PORT}:80" depends_on: - ec-cube - mysql volumes: - ./ec-cube:/var/www/html - ./docker/docker-nginx/default.conf:/etc/nginx/conf.d/default.conf networks: - backend ### MySQL ################################## mysql: image: mysql:5.7 environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: eccubedb MYSQL_USER: dbuser MYSQL_PASSWORD: secret volumes: - mysql-database:/var/lib/mysql ports: - 13306:3306 networks: - backend ### Mailcatcher ################################## mailcatcher: image: schickling/mailcatcher ports: - "1080:1080" - "1025:1025" networks: - backend ### phpMyAdmin phpmyadmin: image: phpmyadmin/phpmyadmin environment: - PMA_ARBITRARY=1 - PMA_HOST=mysql - PMA_USER=root - PMA_PASSWORD=root links: - mysql ports: - 4040:80 networks: - backend
APP_PORT=8080 XDEBUG_INSTALL=true HOST_UID=501 XDEBUG_CLIENT_HOST=host.docker.internal XDEBUG_CLIENT_PORT=9003
FROM nginx:1.11
server { listen 80; index index.php index.html; server_name php-docker.local; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; root /var/www/html/; location / { try_files $uri /index.php$is_args$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass ec-cube:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; internal; } location ~ \\.php$ { return 404; } }
FROM php:7-fpm ENV APACHE_DOCUMENT_ROOT /var/www/html RUN apt-get update \ && apt-get install --no-install-recommends -y \ apt-transport-https \ apt-utils \ build-essential \ curl \ debconf-utils \ gcc \ git \ vim \ zip \ gnupg2 \ libfreetype6-dev \ libicu-dev \ libjpeg62-turbo-dev \ libpng-dev \ libpq-dev \ libzip-dev \ locales \ ssl-cert \ unzip \ zlib1g-dev \ iputils-ping \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && echo "en_US.UTF-8 UTF-8" >/etc/locale.gen \ && locale-gen \ ; RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \ && docker-php-ext-install -j$(nproc) zip gd mysqli pdo_mysql opcache intl pgsql pdo_pgsql \ ; RUN pecl install apcu && echo "extension=apcu.so" > /usr/local/etc/php/conf.d/apc.ini COPY ./docker/docker-php/php.ini /usr/local/etc/php/conf.d/php.ini RUN curl -sS https://getcomposer.org/installer \ | php \ && mv composer.phar /usr/bin/composer RUN composer config -g repos.packagist composer https://packagist.jp ARG XDEBUG_INSTALL ARG BOOL=true RUN if [ ${XDEBUG_INSTALL} = ${BOOL} ]; then \ pecl install xdebug-3.1.5 && docker-php-ext-enable xdebug; \ fi COPY ./docker/docker-php/entrypoint-dev.sh /entrypoint-dev.sh ENTRYPOINT ["/entrypoint-dev.sh"] CMD ["php-fpm"]
#!/bin/sh if [ -n "${HOST_UID}" -a "${HOST_UID}" != "$(id -u www-data)" ]; then usermod -u "${HOST_UID}" www-data fi if [ -n "${HOST_GID}" -a "${HOST_GID}" != "$(id -g www-data)" ]; then groupmod -g "${HOST_GID}" www-data fi if [ ${XDEBUG_INSTALL} = true ]; then ini=$(cat << EOS xdebug.client_host=${XDEBUG_CLIENT_HOST:-$(ip route | awk 'NR==1 {print $3}')} xdebug.client_port=${XDEBUG_CLIENT_PORT} xdebug.start_with_request=yes xdebug.remote_cookie_expire_time=3600 xdebug.mode=debug EOS ) echo "${ini}" >> /usr/local/etc/php/conf.d/php.ini fi exec docker-php-entrypoint "$@"
ERROR: for ec-cube Cannot start service ec-cube: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/entrypoint-dev.sh": permission denied: unknown
$ chmod 755 root/docker/docker-php/entrypoint-dev.sh
opcache.max_accelerated_files = 20000 opcache.memory_consumption=256 realpath_cache_size = 4096K realpath_cache_ttl = 600 memory_limit = 786M // 一行改行入れといてください
$ docker-compose build $ docker-compose up
http://localhost:8080/
$ docker-compose exec ec-cube bash $ composer install --no-scripts --no-autoloader --no-plugins -d /var/www/html $ composer dumpautoload
http://localhost:8080/
$ composer install --no-scripts --no-autoloader --no-plugins -d /var/www/html
$ composer install
# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file # Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration ###> symfony/framework-bundle ### # For production servers, use: "APP_ENV=prod" and "APP_DEBUG=0" # For local development, use: "APP_ENV=dev" and "APP_DEBUG=1" APP_ENV=prod APP_DEBUG=0 ~~ ###> symfony/mailer ### MAILER_DSN=smtp://localhost:25 # 👇 以下のように書き換え MAILER_DSN=smtp://mailcatcher:1025 ###< symfony/mailer ### ~~
2023-01-21追記
こちらのファイルはインストールが成功すると自動で作成されています。(前半で説明するって言っておいて説明してませんでした🙇♂️)
http://localhost:8080/
http://localhost:1080/
http://localhost:4040/