dragg2 commited on
Commit
763ac4b
·
verified ·
1 Parent(s): b063884

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -12
Dockerfile CHANGED
@@ -19,17 +19,20 @@ ENV AUTH_PASSWORD=yourpassword
19
  # Nginx 配置
20
  RUN rm -f /etc/nginx/sites-enabled/default && \
21
  printf 'server {\n\
22
- listen 7860;\n\
23
  server_name _;\n\
 
24
  auth_basic "Restricted Access";\n\
25
  auth_basic_user_file /etc/nginx/.htpasswd;\n\
26
  client_max_body_size 500M;\n\
 
27
  location / {\n\
28
  proxy_pass http://127.0.0.1:8012;\n\
29
  proxy_set_header Host $host;\n\
30
  proxy_set_header X-Real-IP $remote_addr;\n\
31
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\
32
- proxy_set_header X-Forwarded-Proto $scheme;\n\
 
33
  proxy_buffering off;\n\
34
  }\n\
35
  }\n' > /etc/nginx/sites-available/kkfileview && \
@@ -42,14 +45,7 @@ set -e\n\
42
  echo "=== Starting Secure kkFileView ==="\n\
43
  \n\
44
  # 1. 找启动脚本路径\n\
45
- # 自动查找 startup.sh 或 kkFileView 启动文件\n\
46
  STARTUP_SCRIPT=$(find /opt -name "startup.sh" -o -name "kkFileView" | grep "bin/" | head -n 1)\n\
47
- if [ -z "$STARTUP_SCRIPT" ]; then\n\
48
- echo "ERROR: Could not find startup script in /opt"\n\
49
- echo "Listing /opt:"\n\
50
- ls -R /opt\n\
51
- exit 1\n\
52
- fi\n\
53
  echo "Found startup script: $STARTUP_SCRIPT"\n\
54
  \n\
55
  # 2. 配置密码\n\
@@ -62,11 +58,14 @@ sleep 2\n\
62
  \n\
63
  # 4. 启动 kkFileView\n\
64
  echo "Starting kkFileView on port 8012..."\n\
65
- # 如果是 startup.sh,通常需要 bash 执行\n\
 
 
 
66
  if [[ "$STARTUP_SCRIPT" == *".sh" ]]; then\n\
67
- bash "$STARTUP_SCRIPT" > /var/log/kkfileview.log 2>&1 &\n\
68
  else\n\
69
- "$STARTUP_SCRIPT" --server.port=8012 > /var/log/kkfileview.log 2>&1 &\n\
70
  fi\n\
71
  \n\
72
  # 5. 等待端口\n\
 
19
  # Nginx 配置
20
  RUN rm -f /etc/nginx/sites-enabled/default && \
21
  printf 'server {\n\
22
+ listen 7860 default_server;\n\
23
  server_name _;\n\
24
+ \n\
25
  auth_basic "Restricted Access";\n\
26
  auth_basic_user_file /etc/nginx/.htpasswd;\n\
27
  client_max_body_size 500M;\n\
28
+ \n\
29
  location / {\n\
30
  proxy_pass http://127.0.0.1:8012;\n\
31
  proxy_set_header Host $host;\n\
32
  proxy_set_header X-Real-IP $remote_addr;\n\
33
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\
34
+ proxy_set_header X-Forwarded-Proto http;\n\
35
+ proxy_redirect off;\n\
36
  proxy_buffering off;\n\
37
  }\n\
38
  }\n' > /etc/nginx/sites-available/kkfileview && \
 
45
  echo "=== Starting Secure kkFileView ==="\n\
46
  \n\
47
  # 1. 找启动脚本路径\n\
 
48
  STARTUP_SCRIPT=$(find /opt -name "startup.sh" -o -name "kkFileView" | grep "bin/" | head -n 1)\n\
 
 
 
 
 
 
49
  echo "Found startup script: $STARTUP_SCRIPT"\n\
50
  \n\
51
  # 2. 配置密码\n\
 
58
  \n\
59
  # 4. 启动 kkFileView\n\
60
  echo "Starting kkFileView on port 8012..."\n\
61
+ # 创建日志文件并开始后台 tail\n\
62
+ touch /var/log/kkfileview.log\n\
63
+ tail -f /var/log/kkfileview.log &\n\
64
+ \n\
65
  if [[ "$STARTUP_SCRIPT" == *".sh" ]]; then\n\
66
+ bash "$STARTUP_SCRIPT" >> /var/log/kkfileview.log 2>&1 &\n\
67
  else\n\
68
+ "$STARTUP_SCRIPT" --server.port=8012 >> /var/log/kkfileview.log 2>&1 &\n\
69
  fi\n\
70
  \n\
71
  # 5. 等待端口\n\