Browse Source

change alpine

main
xiaoz 4 years ago
parent
commit
3c09b1fdbe
  1. 9
      php/Dockerfile
  2. 10
      php/install.sh
  3. 2
      php/nginx.conf
  4. 2
      php/run.sh

9
php/Dockerfile

@ -1,6 +1,6 @@
FROM php:7.3-fpm-alpine3.12 FROM php:7.3-fpm-alpine3.12
#设置时区 #设置时区,仅Debian需要
ENV TZ=Asia/Shanghai #ENV TZ=Asia/Shanghai
#工作目录 #工作目录
WORKDIR /root WORKDIR /root
#复制安装脚本 #复制安装脚本
@ -8,10 +8,11 @@ COPY ./install.sh /root
#复制启动脚本 #复制启动脚本
COPY ./run.sh /usr/sbin COPY ./run.sh /usr/sbin
#执行安装脚本 #执行安装脚本
RUN bash install.sh RUN sh install.sh
#暴露配置文件 #暴露配置文件
VOLUME /usr/local/nginx/conf/vhost VOLUME /etc/nginx/conf.d
VOLUME /var/www/html VOLUME /var/www/html
VOLUME /var/log/nginx
EXPOSE 80 EXPOSE 80
EXPOSE 443 EXPOSE 443
#运行crontab和nginx #运行crontab和nginx

10
php/install.sh

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
#更新软件 #更新软件
apk update apk update
#安装timezone #安装timezone
@ -19,7 +19,7 @@ apk add wget
function install_nginx() { function install_nginx() {
#安装nginx #安装nginx
apk add nginx apk add nginx
wget -P /etc/nginx https://github.com/helloxz/dnmp/raw/main/php/nginx.conf #wget -P /etc/nginx https://github.com/helloxz/dnmp/raw/main/php/nginx.conf
} }
#设置PHP #设置PHP
function set_php(){ function set_php(){
@ -38,7 +38,11 @@ function set_php(){
&& docker-php-ext-enable redis xdebug && docker-php-ext-enable redis xdebug
} }
#清理工作
function run_clean(){
apk del autoconf gcc musl-dev g++ zlib-dev make wget
}
install_nginx && set_php && run_clean
echo '-----------------------------' echo '-----------------------------'
echo 'nginx + php install success.' echo 'nginx + php install success.'

2
php/nginx.conf

@ -1,4 +1,4 @@
user www www; user www-data www-data;
worker_processes auto; worker_processes auto;
worker_rlimit_nofile 50000; worker_rlimit_nofile 50000;
error_log logs/error.log; error_log logs/error.log;

2
php/run.sh

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
#start nginx #start nginx
/usr/local/nginx/sbin/nginx /usr/sbin/nginx
echo 'start nginx success.' echo 'start nginx success.'
#start php-fpm #start php-fpm
/usr/local/sbin/php-fpm /usr/local/sbin/php-fpm
Loading…
Cancel
Save