1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- FROM busybox:latest
- # copy代码文件
- COPY . /var/application
- COPY ./deploy/deploy-prod/env.example /var/application/.env
- # 安装php-fpm
- FROM php:7.1-fpm-alpine
- # 配置apk的源
- RUN echo "http://mirrors.aliyun.com/alpine/v3.10/main/" > /etc/apk/repositories \
- && echo "http://mirrors.aliyun.com/alpine/v3.10/community/" >> /etc/apk/repositories \
- && apk upgrade --update
- # 安装其他软件
- RUN apk add wget \
- git \
- supervisor \
- zlib-dev \
- nginx \
- && docker-php-ext-install pdo_mysql zip \
- && mkdir /run/nginx
- # copy supervisor文件
- COPY ./deploy/supervisord/supervisord.conf /etc/supervisord.conf
- COPY ./deploy/supervisord/supervisord.d/ /etc/supervisord.d/
- # copy nginx配置文件
- COPY ./deploy/nginx/nginx.conf /etc/nginx/nginx.conf
- # 安装composer
- RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
- && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
- && php -r "unlink('composer-setup.php');" \
- && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
- # copy crontab文件
- COPY ./deploy/crontab/laravel /etc/cron.d/laravel
- RUN chmod -R 644 /etc/cron.d/laravel
- # Apply cron job
- RUN crontab /etc/cron.d/laravel
- ENV COMPOSER_ALLOW_SUPERUSER 1
- COPY --from=0 /var/application /var/www/application
- WORKDIR /var/www/application
- RUN composer install --ignore-platform-reqs --no-dev
- COPY ./deploy/run.sh /usr/local/bin/run.sh
- RUN sed -i 's/www-data/nginx/g' /usr/local/etc/php-fpm.d/www.conf \
- && mkdir -p /usr/share/nginx \
- && ln -s /var/www/application/public /usr/share/nginx/html \
- && chmod +x /usr/local/bin/run.sh
- CMD ["run.sh"]
|