{"id":20963871,"url":"https://github.com/codemix/yii2-dockerbase","last_synced_at":"2025-08-07T07:28:11.430Z","repository":{"id":28556171,"uuid":"32073566","full_name":"codemix/yii2-dockerbase","owner":"codemix","description":"Yii 2 base image for dockerized yii2 projects","archived":false,"fork":false,"pushed_at":"2017-11-15T09:44:27.000Z","size":76,"stargazers_count":38,"open_issues_count":0,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-02T15:42:53.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codemix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-12T11:32:49.000Z","updated_at":"2025-03-15T20:57:51.000Z","dependencies_parsed_at":"2022-08-23T02:00:52.313Z","dependency_job_id":null,"html_url":"https://github.com/codemix/yii2-dockerbase","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fyii2-dockerbase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fyii2-dockerbase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fyii2-dockerbase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fyii2-dockerbase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemix","download_url":"https://codeload.github.com/codemix/yii2-dockerbase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254112280,"owners_count":22016722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T02:48:41.992Z","updated_at":"2025-05-14T09:31:46.944Z","avatar_url":"https://github.com/codemix.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEPRECATED!\n\nThis image is now **DEPRECATED**. We may still push updates for Yii2 2.0.x but\nwill cease with Yii2 2.1.x. Our refactored template under\n[codemix/yii2-dockerized](https://github.com/codemix/yii2-dockerized) now\nincludes a build step for app specific base images instead.\n\n# Supported tags and respective `Dockerfile` links\n\n- [`2.0.13.1-apache`, `2.0-apache`, `apache`, `latest` (*2.0/apache/Dockerfile*)](https://github.com/codemix/yii2-dockerbase/blob/master/2.0/apache/Dockerfile)\n- [`2.0.13.1-php7-apache`, `2.0-php7-apache`, `php7-apache`, `latest-php7` (*2.0/apache/Dockerfile.php7*)](https://github.com/codemix/yii2-dockerbase/blob/master/2.0/apache/Dockerfile.php7)\n- [`2.0.13.1-php-fpm`, `2.0-php-fpm`, `php-fpm` (*2.0/php-fpm/Dockerfile*)](https://github.com/codemix/yii2-dockerbase/blob/master/2.0/php-fpm/Dockerfile)\n- [`2.0.13.1-php7-fpm`, `2.0-php7-fpm`, `php7-fpm` (*2.0/php-fpm/Dockerfile.php7*)](https://github.com/codemix/yii2-dockerbase/blob/master/2.0/php-fpm/Dockerfile.php7)\n- [`2.0.13.1-hhvm`, `2.0-hhvm`, `hhvm` (*2.0/php-fpm/Dockerfile*)](https://github.com/codemix/yii2-dockerbase/blob/master/2.0/hhvm/Dockerfile)\n\nCheck the [tags](https://hub.docker.com/r/codemix/yii2-base/tags/) page for a full list of available tags.\n\nYii 2 Base\n==========\n\nThis is a base image for Yii 2 projects.\n\n\u003e **IMPORTANT: The image does *not* contain an app template!**\n\u003e So you must always first combine it with your own application code to make it work!\n\nThe main purpose of this image is,\n\n * to provide a PHP runtime environment that is configured for Yii and\n * that has the base yii2 composer packages pre-installed.\n\n## 1. Available versions\n\nThere are three flavours of this image\n\n * **Apache with PHP module** (based on `php:7.0.6-apache` or `php:5.6.18-apache`)\n * **PHP-FPM** (based on `php:7.0.6-fpm` or `php:5.6.18-fpm`)\n * **HHVM** (based on `estebanmatias92/hhvm:3.8.1-fastcgi`)\n\n\n## 2. How to use this Image\n\n### 2.1 Using our `yii2-dockerized` Application Template\n\nFor all available flavours we recommend to start with our dockerized application\ntemplate for Yii2.\n\n[https://github.com/codemix/yii2-dockerized](https://github.com/codemix/yii2-dockerized)\n\nIt comes with a ready to use `Dockerfile` and exemplifies how this base image is meant\nto be used.\n\n### 2.2 Using your own Application Template\n\nIf you don't want to use that base template you can still build an application\nfrom scratch. But still we recommend to study that template first.\n\nBefore you build your own application template, you should understand the basic\nidea behind this image:\n\n * The image has all yii2 related composer packages pre-installed under `/var/www/vendor`.\n * The application code is expected under `/var/www/html`, with\n   the public directory being `/var/www/html/web`.\n * You will *never* install any composer packages locally, but\n   always into your container. When you do so, it will either override\n   or add more packages to those already contained in this image.\n\nYou'll also need to prepare some application code locally which will be copied to your\nimage during the build phase. To start, you could use the official base image:\n\n```\ncomposer create-project --no-install yiisoft/yii2-app-basic\n```\n\n\u003e **Note:** You need to fix the paths to `autoload.php` and `Yii.php` in the\n\u003e `index.php` file and also add a `'vendorPath' =\u003e '/var/www/vendor'` option\n\u003e in the `config/web.php`.\n\n\n#### 2.2.1 Using the Apache Variant\n\nCreate a `Dockerfile` in your application directory:\n\n```\nFROM codemix/yii2-base:latest\n\n# Copy your app's source code into the container\nCOPY . /var/www/html\n```\n\nand a `docker-compose.yml`:\n\n```\nweb:\n    build: ./\n    ports:\n        - \"8080:80\"\n    expose:\n        - \"80\"\n    volumes:\n        - ./:/var/www/html/\n```\n\nNow you're ready to run `docker-compose up` to start your app. It should\nbe available from `http://localhost:8080` or your boot2docker VM if you use that.\n\n\n#### 2.2.2 Using the PHP-FPM or HHVM Flavour\n\nCreate a `Dockerfile` in your application directory:\n\n```\nFROM codemix/yii2-base:php-fpm\n# Or for HHVM:\n#FROM codemix/yii2-base:hhvm\n\n# Copy your app's source code into the container\nCOPY . /var/www/html\n```\n\nFor this variant, you'll also need an nginx container. We have included\nan example configuration with a `Dockerfile` in the image. You can copy\nit from the container with:\n\n```\ndocker create --name temp codemix/yii2-base:php-fpm\n# Or for HHVM:\n#docker create --name temp codemix/yii2-base:hhvm\ndocker cp temp:/opt/nginx/ .\ndocker rm temp\n```\n\nFinally create a `docker-compose.yml`:\n\n```\napp:\n    build: ./\n    expose:\n        - \"9000\"\n    volumes:\n        - ./:/var/www/html/\nnginx:\n    build: ./nginx\n    ports:\n        - \"8080:80\"\n    links:\n        - app\n    volumes_from:\n        - app\n```\n\nNow you're ready to run `docker-compose up` to start your app. It should\nbe available from `http://localhost:8080` or your boot2docker VM if you use that.\n\n\n### 2.3 Adding Composer Packages\n\nTo add composer packages, you need to provide a `composer.json` with\nsome modifications:\n\n```\n{\n  \"require\": {\n    \"php\": \"\u003e=5.4.0\",\n    \"yiisoft/yii2\": \"2.0.13.1\",\n    \"yiisoft/yii2-bootstrap\": \"~2.0.0\",\n    \"yiisoft/yii2-jui\": \"~2.0.0\",\n    \"yiisoft/yii2-swiftmailer\": \"~2.0.0\"\n  },\n  \"require-dev\": {\n    \"yiisoft/yii2-debug\": \"~2.0.0\",\n    \"yiisoft/yii2-gii\": \"~2.0.0\",\n    \"yiisoft/yii2-codeception\": \"~2.0.0\",\n    \"yiisoft/yii2-faker\": \"~2.0.0\"\n  },\n  \"config\": {\n    \"process-timeout\": 1800,\n    \"vendor-dir\": \"/var/www/vendor\"\n  },\n  \"extra\": {\n    \"asset-installer-paths\": {\n      \"npm-asset-library\": \"../vendor/npm\",\n      \"bower-asset-library\": \"../vendor/bower\"\n    }\n  }\n}\n```\n\nNote the `vendor-dir` configuration, which is crucial for this setup. It's also\nimportant, that the versions there match those of this image. Otherwhise you again\nloose the advantage of reusing the composer packages contained in the image.\n\nYou also have to map the local directory into the container in your `docker-compose.yml`.\nIf you have problems with githubs rate limit, you can provide a github API token.\n\n```\nweb:\n    build: ./\n    ports:\n        - \"8080:80\"\n    expose:\n        - \"80\"\n    volumes:\n        - ./:/var/www/html/\n    environment:\n        API_TOKEN: \"\u003cYOUR GITHUB API TOKEN\u003e\"\n```\n\nNow you can run the bundled `composer` command in your container.\n\n```\ndocker-compose run --rm web compose update myrepo/mypackage\n```\n\n### 2.4 Adding PHP Extensions\n\nAs the `apache` and `php-fpm` flavours extend from the official [php](https://registry.hub.docker.com/u/library/php/)\nimage, you can use `docker-php-ext-install` in your `Dockerfile`. You may also have to install\nsome required packages with `apt-get install` first. Here's an example:\n\n```\nRUN apt-get update \\\n    \u0026\u0026 apt-get -y install \\\n            libfreetype6-dev \\\n            libjpeg62-turbo-dev \\\n            libmcrypt-dev \\\n            libpng12-dev \\\n        --no-install-recommends \\\n    \u0026\u0026 rm -r /var/lib/apt/lists/* \\\n    \u0026\u0026 docker-php-ext-install iconv mcrypt \\\n    \u0026\u0026 docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \\\n    \u0026\u0026 docker-php-ext-install gd\n```\n\n### 2.5 Adding HHVM Extensions\n\nPlease check the [hhvm](https://registry.hub.docker.com/u/estebanmatias92/hhvm/) base image for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemix%2Fyii2-dockerbase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemix%2Fyii2-dockerbase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemix%2Fyii2-dockerbase/lists"}