Created
March 8, 2021 14:13
-
-
Save leocarmo/633b09105999f87604f9509228abdd6b to your computer and use it in GitHub Desktop.
Dockerfile production ready with Alpine, PHP, Kafka, Swoole, Lumen/Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:8.0.1-cli-alpine3.13 | |
ARG APPLICATION_PATH=/application | |
ARG CONFIGS_PATH=/docker/php | |
LABEL maintainer="Leonardo Carmo <[email protected]>" | |
# install dependecies | |
RUN apk add --no-cache \ | |
bash \ | |
curl \ | |
zip \ | |
unzip \ | |
git \ | |
libressl-dev \ | |
$PHPIZE_DEPS | |
# pecl update | |
RUN pear config-set preferred_state stable && \ | |
pecl channel-update pecl.php.net | |
# phpredis | |
RUN pecl install redis && \ | |
docker-php-ext-enable redis | |
# swoole | |
RUN git clone https://github.com/swoole/swoole-src.git && \ | |
cd swoole-src && \ | |
git checkout v4.6.2 && \ | |
phpize && \ | |
./configure --enable-openssl && \ | |
make && make install && \ | |
docker-php-ext-enable swoole && \ | |
rm -rf /swoole-src | |
# pdo_mysql extention | |
RUN docker-php-ext-install opcache pdo_mysql && \ | |
docker-php-ext-enable opcache | |
# composer | |
RUN curl --insecure https://getcomposer.org/composer-stable.phar -o /usr/bin/composer && \ | |
chmod +x /usr/bin/composer | |
# copy config files | |
COPY $CONFIGS_PATH/php.ini /usr/local/etc/php/conf.d/custom.ini | |
# copy project | |
COPY . $APPLICATION_PATH | |
# permissions for lumen | |
RUN chown nobody:nobody -R $APPLICATION_PATH/storage | |
# clean up | |
RUN rm -rf \ | |
/tmp/* \ | |
/var/lib/apt/lists/* \ | |
/var/tmp/* \ | |
/var/cache/apk/* | |
WORKDIR $APPLICATION_PATH | |
# install composer | |
RUN /usr/bin/composer install --no-dev -o -a | |
# swoole infos | |
RUN php artisan swoole:http infos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment