Git Product home page Git Product logo

yii-docker's Introduction

Yii 3.x PHP Docker Image


Stable Development pipeline status

This is the repo of the official Yii 3.x Framework image on DockerHub for PHP.

About

These Docker images are built on top of the official PHP Docker image, they contain additional PHP extensions required to run Yii 3.x framework, but no code of the framework itself. The Dockerfile(s) of this repository are designed to build from different PHP-versions by using build arguments.

Features

  • built from official Docker images
  • all core-framework tests pass
  • includes Xdebug (not loaded by default)
  • ready for handling client-side packages
  • bash auto-completion
  • fpm-nginx images with built-in webserver (like Apache)

Available versions for yiisoftware/yii-php

The following images are built on a weekly basis for arm64 and amd64. For regular commits on master we only build images for amd64 suffixed with -latest/-latest-min.

Minimal images

8-2-apache-min
8-1-apache-min
8.0-apache-min
8.2-fpm-min
8.1-fpm-min
8.0-fpm-min
8.2-fpm-nginx-min
8.1-fpm-nginx-min
8.0-fpm-nginx-min

Development images, include npm and composer

8.2-apache
8.1-apache
8.0-apache
8.2-fpm
8.1-fpm
8.0-fpm
8.2-fpm-nginx
8.1-fpm-nginx
8.0-fpm-nginx

Deprecated images

7.4-apache-min
7.4-fpm-min
7.4-fpm-nginx-min
7.4-apache
7.4-fpm
7.4-fpm-nginx

Setup

cp .env-dist .env

Adjust the versions in .env if you want to build a specific version.

Note: Please make sure to use a matching combination of DOCKERFILE_FLAVOUR and PHP_BASE_IMAGE_VERSION

Configuration

  • PHP_ENABLE_XDEBUG whether to load an enable Xdebug, defaults to 0 (false) not available in -min images
  • PHP_USER_ID (Debian only) user ID, when running commands as webserver (www-data), see also #15
  • SUPERVISOR_START_FPM (nginx-flavor only) whether to start PHP-fpm by supervisor (default: true)
  • SUPERVISOR_START_NGINX (nginx-flavor only) whether to start nginx by supervisor (default: true)

Building

docker-compose build

Testing

docker-compose run --rm php php /tests/requirements.php

Xdebug

To enable Xdebug, set PHP_ENABLE_XDEBUG=1 in .env file

Xdebug is configured to call ip xdebug.remote_host on 9005 port (not use standard port to avoid conflicts), so you have to configure your IDE to receive connections from that ip.

If you are using macOS, you can fill xdebug.remote_host with host.docker.internal, due to a network limitation on mac (https://docs.docker.com/docker-for-mac/networking/#port-mapping)

(macOS) configuration

xdebug.remote_host=host.docker.internal

Documentation

If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.

License

The Yii 3.x PHP Docker Image is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Software.

Support the project

Open Collective

Follow updates

Official website Twitter Telegram Facebook Slack

yii-docker's People

Contributors

albertborsos avatar armpogart avatar axklim avatar dehbka avatar devanych avatar fantom409 avatar fcaldarelli avatar luizcmarin avatar mikehaertl avatar pchol avatar rustamwin avatar samdark avatar sankaest avatar schmunk42 avatar vjik avatar xepozz avatar yyxx9988 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii-docker's Issues

404 nginx problem

What steps will reproduce the problem?

copy and changed .env file for Nginx

composer create-project -s dev yiisoft/app /app

Open http://127.0.0.1:8100/

What is the expected result?

App Welcome page

What do you get instead?

404 Not Found Nginx page

Additional info

Q A
Version 1.0.?
PHP version 7.4-fpm
Operating system ubuntu 20.04

This problem caused by Nginx config in phundament image - for this repository, web root directory should be set as /app/public, instead, this path is setted as /app/web

*-min images does not have mandatory packages

What steps will reproduce the problem?

use *-min images with mysql for example.

What is the expected result?

it works with mysql

What do you get instead?

it does not work with mysql

Additional info

Q A
Version latest
PHP version 8.2
Operating system linux

I think the *-min images should contain php extensions which are mandatory for the Yii 3.0 framework.

Because these extension installations are in the dev stage:

# Install system packages
RUN apt-get update && \
apt-get -y install \
unzip \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install common system packages for PHP extensions recommended for Yii 2.0 Framework
RUN install-php-extensions \
pcntl-stable \
soap-stable \
zip-stable \
bcmath-stable \
exif-stable \
gd-stable \
opcache-stable \
pdo_mysql-stable \
pdo_pgsql-stable \
imagick-stable \
mongodb-stable \
xdebug-stable \
sockets-stable

I think some of these packages should be installed in the min stage, and some of them (like xdebug) should be installed in the dev stage.

What do you think?

Error on run `yiisoftware/yii-php:8.*-fpm-nginx`

docker-compose.yml:

version: '3'

services:
  php:
    image: yiisoftware/yii-php:8.2-fpm-nginx
    working_dir: /app
    volumes:
      - ./:/app
      # host-volume for composer cache
      - ~/.composer-docker/cache:/root/.composer/cache:delegated
    ports:
      - '30080:80'

Console:

❯ docker compose up
[+] Running 2/2
 ✔ Network app_default  Created                                                                  0.1s
 ✔ Container app-php-1  Created                                                                  2.5s
Attaching to app-php-1
app-php-1  | usermod: no changes
app-php-1  | Error: Format string '%(ENV_SUPERVISOR_START_FPM)s' for 'program:php-fpm.autostart' contains names ('ENV_SUPERVISOR_START_FPM') which cannot be expanded. Available names: ENV_COMPOSER_ALLOW_SUPERUSER, ENV_GPG_KEYS, ENV_HOME, ENV_HOSTNAME, ENV_LC_CTYPE, ENV_PATH, ENV_PHPIZE_DEPS, ENV_PHP_ASC_URL, ENV_PHP_CFLAGS, ENV_PHP_CPPFLAGS, ENV_PHP_ENABLE_XDEBUG, ENV_PHP_INI_DIR, ENV_PHP_LDFLAGS, ENV_PHP_SHA256, ENV_PHP_URL, ENV_PHP_USER_ID, ENV_PHP_VERSION, ENV_PS1, ENV_PWD, ENV_TERM, group_name, here, host_node_name, program_name in section 'program:php-fpm' (file: '/etc/supervisor/conf.d/fpm.conf')
app-php-1  | For help, use /usr/bin/supervisord -h
app-php-1 exited with code 2

Same problem with yiisoftware/yii-php:8.1-fpm-nginx.

Remove pre 7.4 images from DockerHub?

What steps will reproduce the problem?

Try i.e. yii-project-template with an 7.3 image.

What is the expected result?

It should install.

What do you get instead?

Error: PHP 7.3 not supported

Additional info

A con is, that there might be people using these outdated images, but since we're in (pre)-alpha stage I'd say it's OK to remove them, to avoid confusion,
PHP 7.4 was freshly pushed today.

The latest docker images were built without linux/amd64 support

What steps will reproduce the problem?

I have a linux host with amd64 processor.

$ uname -o -p
x86_64 GNU/Linux

And I can`t pull the latest docker images:

$ docker pull yiisoftware/yii-php:8.1-fpm
8.1-fpm: Pulling from yiisoftware/yii-php
no matching manifest for linux/amd64 in the manifest list entries
$ docker pull yiisoftware/yii-php:8.2-fpm
8.2-fpm: Pulling from yiisoftware/yii-php
no matching manifest for linux/amd64 in the manifest list entries

What is the expected result?

Previous version are pullable. I want the same result in the latest version.

$ docker pull yiisoftware/yii-php:8.1-fpm-22.7.1
8.1-fpm-22.7.1: Pulling from yiisoftware/yii-php
461246efe0a7: Already exists 
220ce72386de: Pull complete
...

Additional info

Last images is build for arm64 only:

$ docker manifest inspect yiisoftware/yii-php:8.1-fpm
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.oci.image.index.v1+json",
   "manifests": [
      {
         "mediaType": "application/vnd.oci.image.manifest.v1+json",
         "size": 4845,
         "digest": "sha256:225fb27ab37fbd89cfc400564e8da17255cd0f7ff30a6f4e0b2c6a1bff3f9095",
         "platform": {
            "architecture": "arm64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.oci.image.manifest.v1+json",
         "size": 566,
         "digest": "sha256:3651b9b1d7574035b2bd549863f73930020e996eecb478bbf3873c38f26dc0c3",
         "platform": {
            "architecture": "unknown",
            "os": "unknown"
         }
      }
   ]
}

yarn is missing

What steps will reproduce the problem?

  • clone yii3 application template
  • set up docker
  • log in to shell
  • execute composer install

What is the expected result?

composer install successfully finished

What do you get instead?

Package operations: 143 installs, 0 updates, 0 removals
  - Installing foxy/foxy (v1.1.0): Loading from cache

                                          
  [Foxy\Exception\RuntimeException]       
  The binary of "yarn" must be installed  

after npm install -g yarn composer runs successfully

Additional info

Q A
Version 1.0.?
PHP version 7.4-apache
Operating system host OS: MacOS

How I can get php 8?

docker pull yiisoftware/yii-php:8.0-fpm
Error response from daemon: manifest for yiisoftware/yii-php:8.0-fpm not found: manifest unknown: manifest unknown

How I can get php 8?

Docker for tests

I'd like to discuss the possibility of adding Docker setups in each repositories to help developers running tests.

This wouldn't be a requirement to run tests, and it won't be involved during the Travis builds.

It would allow us to run docker-compose up in the tests directory and immediately having a working environment to fiddle with the extension.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.