diff --git a/Dockerfile b/Dockerfile index d84fab0..2061015 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,12 @@ FROM alpine -RUN mkdir -p /var/www/machete && \ - mkdir -p /var/www/downloads && \ - apk add gcc g++ make cmake pkgconf libxml2-dev sqlite-dev && \ - cd /var/www/downloads && \ - wget "https://nginx.org/download/nginx-1.21.6.tar.gz" && \ - wget "https://www.php.net/distributions/php-8.1.6.tar.gz" && \ - tar -zxvf nginx-1.21.6.tar.gz && \ - tar -zxvf php-8.1.6.tar.gz && \ - cd nginx-1.21.6/ && \ - ./configure --without-http_rewrite_module --without-http_gzip_module && \ - make && make install && \ - cd ../php-8.1.6/ && \ - ./configure --enable-fpm && make && make install && \ - cd ../ && wget "https://git.filesite.io/filesite/machete/archive/master.tar.gz" && \ +RUN apk add php8-fpm nginx && \ + mkdir -p /var/www/downloads && cd /var/www/downloads/ && \ + wget "https://git.filesite.io/filesite/machete/archive/master.tar.gz" && \ tar -zxvf master.tar.gz && \ - mv machete/* /var/www/machete/ && \ + mv machete/ /var/www/ && \ cd /var/www/ && rm -rf downloads/ && \ - cd /var/www/machete/ && \ - mkdir -p /usr/local/nginx/conf/conf.d && \ - rm -f /usr/local/nginx/conf/nginx.conf && \ - cp conf/nginx_default.conf /usr/local/nginx/conf/nginx.conf && \ - cp conf/nginx_machete.conf /usr/local/nginx/conf/conf.d/machete.conf + rm -f /etc/nginx/http.d/default.conf && \ + cp /var/www/machete/conf/nginx_machete.conf /etc/nginx/http.d/machete.conf EXPOSE 80/tcp ENTRYPOINT ["/var/www/machete/docker-entrypoint.sh"] diff --git a/conf/nginx_default.conf b/conf/nginx_default.conf deleted file mode 100644 index 5ba3c77..0000000 --- a/conf/nginx_default.conf +++ /dev/null @@ -1,35 +0,0 @@ -#user nobody; -worker_processes 1; - -#error_log logs/error.log; -#error_log logs/error.log notice; -#error_log logs/error.log info; - -#pid logs/nginx.pid; - - -events { - worker_connections 1024; -} - - -http { - include mime.types; - default_type application/octet-stream; - - #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - # '$status $body_bytes_sent "$http_referer" ' - # '"$http_user_agent" "$http_x_forwarded_for"'; - - #access_log logs/access.log main; - - sendfile on; - #tcp_nopush on; - - #keepalive_timeout 0; - keepalive_timeout 65; - - #gzip on; - - include /usr/local/nginx/conf/conf.d/*.conf; -} diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index d1f830c..6c40a02 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -13,4 +13,9 @@ cp "template_${theme}.php" app.php ## 启动nginx和php-fpm -/usr/local/nginx/sbin/nginx +if [ -e /usr/sbin/nginx ]; then + /usr/sbin/nginx +fi +if [ -e /usr/sbin/php-fpm8 ]; then + /usr/sbin/php-fpm8 -D +fi