Dockerfile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. FROM php:7.3-fpm-alpine
  2. WORKDIR "/app"
  3. #COPY ./sources.list /etc/apt/sources.list
  4. # 修改镜像源
  5. RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
  6. #RUN wget -P /tmp/ http://nginx.org/download/nginx-1.15.11.tar.gz
  7. #RUN cd /tmp/;tar xzf nginx-1.15.11.tar.gz;cd nginx-1.15.11;sed -i -e 's/1.15.11//g' -e 's/nginx\//WS/g' -e 's/"NGINX"/"WS"/g' src/core/nginx.h
  8. #RUN cd /tmp/nginx-1.15.11;./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module;make;make install
  9. # 安装依赖,核心扩展,pecl扩展,git,composer,npm工具
  10. RUN apk update && apk add --no-cache tzdata && apk add nginx && apk add --no-cache --virtual .build-deps \
  11. $PHPIZE_DEPS \
  12. curl-dev \
  13. libzip-dev \
  14. libtool \
  15. libxml2-dev \
  16. sqlite-dev \
  17. libmcrypt-dev \
  18. freetype-dev \
  19. libjpeg-turbo-dev \
  20. libpng-dev \
  21. && apk add --no-cache \
  22. curl \
  23. git \
  24. mysql-client \
  25. # 配置npm中国镜像
  26. && pecl install mcrypt-1.0.2 \
  27. && docker-php-ext-enable mcrypt \
  28. && docker-php-ext-install \
  29. bcmath \
  30. curl \
  31. mbstring \
  32. pdo \
  33. pdo_mysql \
  34. pcntl \
  35. tokenizer \
  36. xml \
  37. zip \
  38. && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
  39. && docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" gd \
  40. && pecl install -o -f redis \
  41. && rm -rf /tmp/pear \
  42. && docker-php-ext-enable redis
  43. # 安装composer并允许root用户运行
  44. ENV COMPOSER_ALLOW_SUPERUSER=1
  45. ENV COMPOSER_NO_INTERACTION=1
  46. ENV COMPOSER_HOME=/usr/local/share/composer
  47. RUN mkdir -p /usr/local/share/composer \
  48. && curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
  49. && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --snapshot \
  50. && rm -f /tmp/composer-setup.* \
  51. # 配置composer中国全量镜像
  52. && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
  53. # Expose port 9000 and start php-fpm server
  54. #EXPOSE 9000
  55. ENV TZ=Asia/Shanghai
  56. RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
  57. COPY . /app
  58. COPY ./nginx/default.conf /etc/nginx/conf.d/
  59. COPY ./nginx/https.conf /etc/nginx/conf.d/
  60. COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
  61. COPY ./php-fpm/up.sh /usr/local/bin
  62. COPY ./php-fpm/php-ini-overrides.ini /usr/local/etc/php/conf.d/overrides.ini
  63. RUN mkdir -p /run/nginx
  64. RUN chmod a+x /usr/local/bin/up.sh
  65. RUN chmod a+x /app/www/new_sdk/crontab.sh
  66. RUN crontab ./crontabs/crontabfile.txt
  67. CMD ["/bin/sh", "/usr/local/bin/up.sh", "/app/www/new_sdk/crontab.sh"]