Docker image for Swoole apps with Composer, auto-restart on development and a production-ready version.
composer.json
index.php
(this will be your entry-point)
Entry-point file can be overridden with the environment variable ENTRY_POINT_FILE
. See this for an example.
A docker-compose.yml
file would look like:
version: "3"
services:
web:
container_name: my_app
image: leocavalcante/dwoole:dev
volumes:
- ./:/app
ports:
- "9501:9501"
Yeah! Simple like that.
Options enabled:
--enable-openssl
--enable-sockets
--enable-http2
--enable-mysqlnd
Comes bundled with:
- Hot-restart
- PDO MySQL & MySQLi
- MongoDB
- Redis
Comes bundled with:
- Nothing
It is Swoole only. That is because only you knows what your project really needs. The recommended way to use the production variant is as a base image for you project image.
FROM leocavalcante/dwoole:prod
# Add only what your project really needs
COPY . /app
Then you can add whatever extensions you would like.
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
docker-php-ext-install -j$(nproc) \
exif \
gd \
mysqli \
pdo_mysql
RUN pecl install mongodb \
&& docker-php-ext-enable mongodb
RUN pecl install redis \
&& docker-php-ext-enable redis
You can always take a look at the development Dockerfile to see how it installs extensions that you might have used.
⚠ Dwoole will always commit to the latest PHP and Swoole versions