hijnu commited on
Commit
b5152f1
·
verified ·
1 Parent(s): 148af65

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -15
Dockerfile CHANGED
@@ -1,21 +1,21 @@
1
  # 使用 PostgreSQL 作为基础镜像
2
  FROM postgres:15
3
 
4
- # 设置构建时变量,确保为每个变量提供默认值
5
- ARG DUMP_URL=""
6
- ARG DUMP_PASSWORD=""
 
 
 
 
7
  ARG POSTGRES_USER=n8n
8
  ARG POSTGRES_PASSWORD=n8n
9
  ARG POSTGRES_DB=n8n
10
- ARG WEBHOOK_URL=https://aigenai-db.hf.space/
11
  ARG WORKDIR=/app
12
  ARG DB_IMPORT=yes
13
  ARG NODEJS_VER=20
14
- ARG WEBDAV_URL="https://cfr2.n8n.us.kg/"
15
- ARG WEBDAV_USER="your_username"
16
- ARG WEBDAV_PASSWORD="your_password"
17
 
18
- # 设置环境变量
19
  ENV POSTGRES_USER=${POSTGRES_USER} \
20
  POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \
21
  POSTGRES_DB=${POSTGRES_DB} \
@@ -44,7 +44,6 @@ ENV POSTGRES_USER=${POSTGRES_USER} \
44
  COPY requirements.txt ${WORKDIR}/requirements.txt
45
  COPY package.txt ${WORKDIR}/package.txt
46
 
47
- # 安装必要的软件包、Node.js,Python,并设置时区,清理 apt 缓存以减少镜像大小
48
  RUN apt-get update && apt-get install -y \
49
  curl unzip gnupg build-essential sudo vim git procps lsof net-tools \
50
  ca-certificates openssl tzdata python3 python3-venv python3-pip gosu \
@@ -60,7 +59,6 @@ RUN apt-get update && apt-get install -y \
60
  $VIRTUAL_ENV/bin/pip install -r ${WORKDIR}/requirements.txt && \
61
  npm install -g $(cat ${WORKDIR}/package.txt)
62
 
63
- # 设置工作目录并复制脚本
64
  WORKDIR ${WORKDIR}
65
  COPY run.sh ${WORKDIR}/run.sh
66
  COPY import-db.sh ${WORKDIR}/import-db.sh
@@ -68,17 +66,13 @@ COPY backup.sh ${WORKDIR}/backup.sh
68
 
69
  RUN chmod +x ${WORKDIR}/run.sh ${WORKDIR}/import-db.sh ${WORKDIR}/backup.sh
70
 
71
- # 更改 postgres 用户 UID 和 GID 为 1000,设置备份目录
72
  USER root
73
  RUN usermod -u 1000 postgres && groupmod -g 1000 postgres && \
74
  chown -R postgres:postgres /var/lib/postgresql /var/run/postgresql ${WORKDIR} && \
75
  mkdir -p ${WORKDIR}/backups && chmod -R 775 ${WORKDIR}/backups
76
 
77
- # 切换到 postgres 用户
78
  USER postgres
79
 
80
- # 暴露 n8n 服务端口
81
  EXPOSE 7860
82
 
83
- # 运行脚本
84
- CMD ./run.sh
 
1
  # 使用 PostgreSQL 作为基础镜像
2
  FROM postgres:15
3
 
4
+ # 主要变量,确保为你实际的值,可在HF设置中设置的值
5
+ ARG WEBHOOK_URL=https://你的hf账户名-空间名.hf.space/
6
+ ARG WEBDAV_URL="https://cfr2.n8n.us.kg/"
7
+ ARG WEBDAV_USER="your_username"
8
+ ARG WEBDAV_PASSWORD="your_password"
9
+
10
+ # 一般变量,使用默认即可,可在HF设置中设置的值
11
  ARG POSTGRES_USER=n8n
12
  ARG POSTGRES_PASSWORD=n8n
13
  ARG POSTGRES_DB=n8n
 
14
  ARG WORKDIR=/app
15
  ARG DB_IMPORT=yes
16
  ARG NODEJS_VER=20
 
 
 
17
 
18
+ # 设置环境变量,使用默认即可。
19
  ENV POSTGRES_USER=${POSTGRES_USER} \
20
  POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \
21
  POSTGRES_DB=${POSTGRES_DB} \
 
44
  COPY requirements.txt ${WORKDIR}/requirements.txt
45
  COPY package.txt ${WORKDIR}/package.txt
46
 
 
47
  RUN apt-get update && apt-get install -y \
48
  curl unzip gnupg build-essential sudo vim git procps lsof net-tools \
49
  ca-certificates openssl tzdata python3 python3-venv python3-pip gosu \
 
59
  $VIRTUAL_ENV/bin/pip install -r ${WORKDIR}/requirements.txt && \
60
  npm install -g $(cat ${WORKDIR}/package.txt)
61
 
 
62
  WORKDIR ${WORKDIR}
63
  COPY run.sh ${WORKDIR}/run.sh
64
  COPY import-db.sh ${WORKDIR}/import-db.sh
 
66
 
67
  RUN chmod +x ${WORKDIR}/run.sh ${WORKDIR}/import-db.sh ${WORKDIR}/backup.sh
68
 
 
69
  USER root
70
  RUN usermod -u 1000 postgres && groupmod -g 1000 postgres && \
71
  chown -R postgres:postgres /var/lib/postgresql /var/run/postgresql ${WORKDIR} && \
72
  mkdir -p ${WORKDIR}/backups && chmod -R 775 ${WORKDIR}/backups
73
 
 
74
  USER postgres
75
 
 
76
  EXPOSE 7860
77
 
78
+ CMD ./run.sh