Files changed (2) hide show
  1. Dockerfile +5 -0
  2. entrypoint.sh +7 -4
Dockerfile CHANGED
@@ -15,6 +15,11 @@ ENV HOME=/home/user \
15
  COPY --chown=user entrypoint.sh /home/user/entrypoint.sh
16
  RUN chmod +x /home/user/entrypoint.sh
17
 
 
 
 
 
 
18
  # 设置工作目录
19
  WORKDIR /home/user
20
 
 
15
  COPY --chown=user entrypoint.sh /home/user/entrypoint.sh
16
  RUN chmod +x /home/user/entrypoint.sh
17
 
18
+ # 确保/home目录可写(这很重要!)
19
+ USER root
20
+ RUN chmod 777 /home
21
+ USER user
22
+
23
  # 设置工作目录
24
  WORKDIR /home/user
25
 
entrypoint.sh CHANGED
@@ -1,12 +1,12 @@
1
  #!/bin/sh
2
  set -e
3
- CONFIG_FILE_PATH="/home/user/api.yaml"
4
 
5
  echo "DEBUG: Entrypoint script started."
6
 
7
  # 检查Secret是否存在
8
  if [ -z "$API_YAML_CONTENT" ]; then
9
- echo "ERROR: Secret 'API_YAML_CONTENT' is not set or empty. Exiting."
10
  exit 1
11
  else
12
  echo "DEBUG: API_YAML_CONTENT secret found. Preparing to write..."
@@ -15,6 +15,9 @@ else
15
 
16
  if [ -f "$CONFIG_FILE_PATH" ]; then
17
  echo "DEBUG: File $CONFIG_FILE_PATH created successfully. Size: $(wc -c < "$CONFIG_FILE_PATH") bytes."
 
 
 
18
  else
19
  echo "ERROR: File $CONFIG_FILE_PATH was NOT created."
20
  exit 1
@@ -22,6 +25,6 @@ else
22
  fi
23
 
24
  echo "DEBUG: About to execute python main.py..."
25
- # 使用配置文件路径作为参数
26
  cd /home
27
- exec python main.py --config "$CONFIG_FILE_PATH" "$@"
 
1
  #!/bin/sh
2
  set -e
3
+ CONFIG_FILE_PATH="/home/api.yaml" # 注意这里改成/home/api.yaml
4
 
5
  echo "DEBUG: Entrypoint script started."
6
 
7
  # 检查Secret是否存在
8
  if [ -z "$API_YAML_CONTENT" ]; then
9
+ echo "ERROR: Secret 'API_YAML_CONTENT' is不存在或为空。退出。"
10
  exit 1
11
  else
12
  echo "DEBUG: API_YAML_CONTENT secret found. Preparing to write..."
 
15
 
16
  if [ -f "$CONFIG_FILE_PATH" ]; then
17
  echo "DEBUG: File $CONFIG_FILE_PATH created successfully. Size: $(wc -c < "$CONFIG_FILE_PATH") bytes."
18
+ # 显示文件的前几行进行调试(注意不要显示敏感信息)
19
+ echo "DEBUG: First few lines (without sensitive info):"
20
+ head -n 3 "$CONFIG_FILE_PATH" | grep -v "api:" | grep -v "password"
21
  else
22
  echo "ERROR: File $CONFIG_FILE_PATH was NOT created."
23
  exit 1
 
25
  fi
26
 
27
  echo "DEBUG: About to execute python main.py..."
28
+ # 不需要使用--config参数,因为程序有默认路径
29
  cd /home
30
+ exec python main.py "$@"