orztv commited on
Commit
59802b0
·
1 Parent(s): ad5bc33
Files changed (2) hide show
  1. Dockerfile +6 -10
  2. run.sh +3 -0
Dockerfile CHANGED
@@ -8,7 +8,7 @@ ARG CACHEBUST=1
8
 
9
  # 设置构建参数,提供默认值
10
  ARG WEBHOOK_URL=https://你的hf账户名-空间名.hf.space/
11
- ARG POSTGRESDB_PORT=5432
12
 
13
  # 设置基本环境变量
14
  ENV WEBHOOK_URL=${WEBHOOK_URL} \
@@ -58,15 +58,11 @@ RUN --mount=type=secret,id=POSTGRES_USER,mode=0444,required=true \
58
  --mount=type=secret,id=POSTGRES_PASSWORD,mode=0444,required=true \
59
  --mount=type=secret,id=POSTGRES_DB,mode=0444,required=true \
60
  --mount=type=secret,id=POSTGRESDB_HOST,mode=0444,required=true \
61
- echo "DB_POSTGRESDB_HOST=$(cat /run/secrets/POSTGRESDB_HOST)" >> /tmp/env_vars && \
62
- echo "DB_POSTGRESDB_USER=$(cat /run/secrets/POSTGRES_USER)" >> /tmp/env_vars && \
63
- echo "DB_POSTGRESDB_PASSWORD=$(cat /run/secrets/POSTGRES_PASSWORD)" >> /tmp/env_vars && \
64
- echo "DB_POSTGRESDB_DATABASE=$(cat /run/secrets/POSTGRES_DB)" >> /tmp/env_vars
65
-
66
- # 导入数据库环境变量
67
- SHELL ["/bin/bash", "-c"]
68
- RUN source /tmp/env_vars && \
69
- rm -f /tmp/env_vars
70
 
71
  # 创建工作目录
72
  WORKDIR /home/pn/n8n
 
8
 
9
  # 设置构建参数,提供默认值
10
  ARG WEBHOOK_URL=https://你的hf账户名-空间名.hf.space/
11
+ ARG POSTGRESDB_PORT
12
 
13
  # 设置基本环境变量
14
  ENV WEBHOOK_URL=${WEBHOOK_URL} \
 
58
  --mount=type=secret,id=POSTGRES_PASSWORD,mode=0444,required=true \
59
  --mount=type=secret,id=POSTGRES_DB,mode=0444,required=true \
60
  --mount=type=secret,id=POSTGRESDB_HOST,mode=0444,required=true \
61
+ echo "export DB_POSTGRESDB_HOST=$(cat /run/secrets/POSTGRESDB_HOST)" >> /home/pn/.env && \
62
+ echo "export DB_POSTGRESDB_USER=$(cat /run/secrets/POSTGRES_USER)" >> /home/pn/.env && \
63
+ echo "export DB_POSTGRESDB_PASSWORD=$(cat /run/secrets/POSTGRES_PASSWORD)" >> /home/pn/.env && \
64
+ echo "export DB_POSTGRESDB_DATABASE=$(cat /run/secrets/POSTGRES_DB)" >> /home/pn/.env && \
65
+ chown pn:pn /home/pn/.env
 
 
 
 
66
 
67
  # 创建工作目录
68
  WORKDIR /home/pn/n8n
run.sh CHANGED
@@ -1,6 +1,9 @@
1
  #!/bin/bash
2
  set -e
3
 
 
 
 
4
  current_time=$(date +"%Y-%m-%d %H:%M:%S")
5
  echo "Starting n8n at $current_time"
6
 
 
1
  #!/bin/bash
2
  set -e
3
 
4
+ # 导入环境变量
5
+ source /home/pn/.env
6
+
7
  current_time=$(date +"%Y-%m-%d %H:%M:%S")
8
  echo "Starting n8n at $current_time"
9