Dockerfile-lumen

Dckerfile for Lumen
mail@pastecode.io avatar
unknown
dockerfile
3 years ago
2.0 kB
6
Indexable
Never
FROM php:7.4-alpine
COPY --from=composer /usr/bin/composer /usr/bin/composer

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both composer.json AND composer.lock are copied
# where available
COPY composer.* ./

# Bundle app source
COPY . .

RUN ["apk", "add", "autoconf"]
RUN ["apk", "add", "gcc"]
RUN ["apk", "add", "make"]
RUN ["apk", "add", "libc-dev"]
RUN ["apk", "add", "openssl-dev"]
RUN ["apk", "add", "git"]
RUN ["apk", "add", "php7-curl"]
RUN ["apk", "add", "php7-fileinfo"]
RUN ["apk", "add", "php7-json"]
RUN ["apk", "add", "php7-mbstring"]
RUN ["apk", "add", "php7-mongodb"]
RUN ["apk", "add", "php7-pdo"]
RUN ["apk", "add", "php7-openssl"]
RUN ["pecl", "install", "mongodb"]
RUN echo "extension=mongodb.so" > "$PHP_INI_DIR/conf.d/mongodb.ini"
RUN ["pecl", "install", "apfd"]

RUN ["docker-php-ext-install", "bcmath"]
#RUN ["docker-php-ext-install", "mongodb"]
RUN ["docker-php-ext-install", "sockets"]
RUN ["composer", "install", "--no-ansi", "--no-dev", "--no-interaction", "--no-plugins", "--no-progress", "--no-scripts", "--no-suggest", "--optimize-autoloader"]

RUN ["pecl", "install", "apcu"]
RUN ["docker-php-ext-enable", "apcu"]

RUN ["apk", "add", "nginx"]
RUN ["apk", "add", "nginx-mod-http-headers-more"]
RUN ["apk", "add", "php7-fpm"]

COPY docker/nginx-conf/nginx.conf /etc/nginx/
COPY docker/nginx-conf/default.conf /etc/nginx/conf.d/
COPY docker/php-fpm-conf/www.conf /etc/php7/php-fpm.d/
COPY docker/php-conf/php.ini /etc/php7/php.ini

#RUN chown -R www-data:www-data /usr/src/app

RUN ln -s /dev/stdout /var/log/nginx/access.log
RUN ln -s /dev/stderr /var/log/nginx/error.log

RUN crontab -l > mycron
RUN echo "* * * * * cd /usr/src/app && php artisan schedule:run >> /dev/null 2>&1" >> mycron
RUN crontab mycron
RUN rm mycron

EXPOSE 8000
ADD docker/start.sh /
RUN chmod +x /start.sh
CMD [ "/start.sh" ]