Docker で Phalcon を利用する、多くの方法があります。
Our official images are located here. We always welcome pull requests and improvements. The repository for the docker files is located here: https://github.com/phalcon/dockerfiles.
With Phalcon-compose you can create an isolated environment with docker, that will allow you to use Phalcon without any additional installations. Note that using Phalcon Compose, requires Docker Engine >= 1.10.0 および Docker Compose >= 1.6.2
Phalcon Compose offers the following services by default:
Phalcon Compose is very easy to use. Assume that you need to create an application that will be located in: /home/website
. We will now need to run the following command for our container application can be created:
composer create-project sergeyklay/phalcon-compose --prefer-dist /home/website
The above command will download the skeleton of the docker environment.
You will need to create a new file called variables.env
in /home/website
. A sample file has been provided called variables.env.example
.
cd /home/website
cp variables.env.example variables.env
nano variables.env
Adjust the variables in that file to suit your needs. The most important variable is the WEB_ALIAS_DOMAIN
. Change the name to something you will be able to use. In our case we just leave the default called phalcon.local
.
Open your hosts file (/etc/hosts
) and enter a new line like this:
127.0.0.1 phalcon.local
You might want to edit the docker-compose.yml
file and remove services that you will not be using. Phalcon Compose offers a lot of services as mentioned above, so your application might not need some of them. Removing the relevant services from the docker-compose.yml
file will reduce memory usage of your environment.
You can now build the environment.
docker-compose build
Containers will be downloaded as needed and set up on your environment.
You can now launch the environment:
cd /home/website
docker-compose up -d
Go to http://phalcon.local
in your browser and you will see your environment is set up. You can now develop your application in the app folder.
To shut down the environment when is no longer needed you can issue the following command:
cd /home/website
docker-compose down
Additional information can be found at: https://phalcon.link/compose