Browse Source

Dockerfile update

master
filesite 3 years ago
parent
commit
d5e1914b10
  1. 13
      Dockerfile
  2. 35
      conf/nginx_default.conf
  3. 48
      conf/nginx_machete.conf
  4. 32
      conf/template_googleimage.php
  5. 32
      conf/template_manual.php
  6. 32
      conf/template_webdirectory.php
  7. 20
      docker-entrypoint.sh

13
Dockerfile

@ -11,9 +11,18 @@ RUN mkdir -p /var/www/machete && \ @@ -11,9 +11,18 @@ RUN mkdir -p /var/www/machete && \
./configure --without-http_rewrite_module --without-http_gzip_module && \
make && make install && \
cd ../php-8.1.6/ && \
./configure --enable-fpm && make && make install
##TODO: 下载最新源码,并配置好nginx完成部署
./configure --enable-fpm && make && make install && \
cd ../ && wget "https://git.filesite.io/filesite/machete/archive/master.tar.gz" && \
tar -zxvf master.tar.gz && \
mv machete/* /var/www/machete/ && \
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
EXPOSE 80/tcp
ENTRYPOINT ["/var/www/machete/docker-entrypoint.sh"]
## 默认使用导航站皮肤:webdirectory
CMD ["webdirectory"]

35
conf/nginx_default.conf

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
#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;
}

48
conf/nginx_machete.conf

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
# machete
server {
listen 80;
server_name _;
#charset UTF-8;
#access_log logs/machete.access.log main;
root /var/www/machete/www;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ ^/index\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/machete/www$fastcgi_script_name;
include fastcgi_params;
}
# deny all other php
location ~ \.php {
deny all;
}
# deny all md
location ~ \.md {
deny all;
}
# deny all txt
location ~ \.txt {
deny all;
}
# deny all url
location ~ \.url {
deny all;
}
# deny all hidden files
location ~ /\. {
deny all;
}
}

32
conf/template_googleimage.php

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
<?php
/**
* Config of 图片站googleimage
*/
return array(
'default_timezone' => 'Asia/Shanghai', //timezone
//文档站皮肤
//'content_directory' => 'content/', //directory of contents in /www/
//when it's empty, use layout and views in directory views/
//'theme' => 'manual', //name of theme which is enabled
//导航站皮肤
//'content_directory' => 'navs/', //directory of contents in /www/
//'theme' => 'webdirectory',
//图片站皮肤
'content_directory' => 'dogs/', //directory of contents in /www/
'theme' => 'googleimage', //name of theme which is enabled
'default_layout' => 'main', //default layout
'error_layout' => 'error', //exception layout, show error title and content
//for debug, log directory: ../runtime/logs/
'debug' => false,
//for themes
'googleimage' => [
'imageHeight' => 180, //图片高度,单位:px
'contact' => 'FileSite图片网站订制联系:<a href="https://filesite.io" target="_blank">FileSite.io</a>',
],
);

32
conf/template_manual.php

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
<?php
/**
* Config of 文档站manual
*/
return array(
'default_timezone' => 'Asia/Shanghai', //timezone
//文档站皮肤
'content_directory' => 'content/', //directory of contents in /www/
//when it's empty, use layout and views in directory views/
'theme' => 'manual', //name of theme which is enabled
//导航站皮肤
//'content_directory' => 'navs/', //directory of contents in /www/
//'theme' => 'webdirectory',
//图片站皮肤
//'content_directory' => 'dogs/', //directory of contents in /www/
//'theme' => 'googleimage', //name of theme which is enabled
'default_layout' => 'main', //default layout
'error_layout' => 'error', //exception layout, show error title and content
//for debug, log directory: ../runtime/logs/
'debug' => false,
//for themes
//'googleimage' => [
// 'imageHeight' => 180, //图片高度,单位:px
// 'contact' => 'FileSite图片网站订制联系:<a href="https://filesite.io" target="_blank">FileSite.io</a>',
//],
);

32
conf/template_webdirectory.php

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
<?php
/**
* Config of 导航站webdirectory
*/
return array(
'default_timezone' => 'Asia/Shanghai', //timezone
//文档站皮肤
//'content_directory' => 'content/', //directory of contents in /www/
//when it's empty, use layout and views in directory views/
//'theme' => 'manual', //name of theme which is enabled
//导航站皮肤
'content_directory' => 'navs/', //directory of contents in /www/
'theme' => 'webdirectory',
//图片站皮肤
//'content_directory' => 'dogs/', //directory of contents in /www/
//'theme' => 'googleimage', //name of theme which is enabled
'default_layout' => 'main', //default layout
'error_layout' => 'error', //exception layout, show error title and content
//for debug, log directory: ../runtime/logs/
'debug' => false,
//for themes
//'googleimage' => [
// 'imageHeight' => 180, //图片高度,单位:px
// 'contact' => 'FileSite图片网站订制联系:<a href="https://filesite.io" target="_blank">FileSite.io</a>',
//],
);

20
docker-entrypoint.sh

@ -1,20 +1,16 @@ @@ -1,20 +1,16 @@
#!/bin/sh
themes=(
manual
googleimage
webdirectory
)
theme=$1
if [ ! -z "${theme}" ]; then
if [[ ! "${themes[@]}" =~ "${theme}" ]]; then
theme=webdirectory
fi
else
if [ ! -d "/var/www/machete/themes/${theme}/" ]; then
theme=webdirectory
fi
echo "Theme chosed [${theme}]."
##TODO: 复制对应皮肤的配置文件到docker容器指定目录
## 复制对应皮肤的配置文件
cd /var/www/machete/conf/
rm -f app.php
cp "template_${theme}.php" app.php
## 启动nginx和php-fpm
/usr/local/nginx/sbin/nginx

Loading…
Cancel
Save