AZLABS commited on
Commit
8b62d8e
·
verified ·
1 Parent(s): 3565651

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -6
Dockerfile CHANGED
@@ -1,13 +1,13 @@
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
@@ -15,7 +15,7 @@ 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} \
@@ -41,9 +41,11 @@ ENV POSTGRES_USER=${POSTGRES_USER} \
41
  WORKDIR=${WORKDIR} \
42
  PATH="$WORKDIR/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
43
 
 
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 \
@@ -58,20 +60,28 @@ RUN apt-get update && apt-get install -y \
58
  $VIRTUAL_ENV/bin/pip install -r ${WORKDIR}/requirements.txt && \
59
  npm install -g $(cat ${WORKDIR}/package.txt)
60
 
 
61
  WORKDIR ${WORKDIR}
 
 
62
  COPY run.sh ${WORKDIR}/run.sh
63
  COPY import-db.sh ${WORKDIR}/import-db.sh
64
  COPY backup.sh ${WORKDIR}/backup.sh
65
 
 
66
  RUN chmod +x ${WORKDIR}/run.sh ${WORKDIR}/import-db.sh ${WORKDIR}/backup.sh
67
 
 
68
  USER root
69
  RUN usermod -u 1000 postgres && groupmod -g 1000 postgres && \
70
  chown -R postgres:postgres /var/lib/postgresql /var/run/postgresql ${WORKDIR} && \
71
  mkdir -p ${WORKDIR}/backups && chmod -R 775 ${WORKDIR}/backups
72
 
 
73
  USER postgres
74
 
 
75
  EXPOSE 7860
76
 
77
- CMD ./run.sh
 
 
1
+ # Use PostgreSQL as the base image
2
  FROM postgres:15
3
 
4
+ # Main variables, ensure they match your actual values, which can be set in HF settings
5
+ ARG WEBHOOK_URL=https://azlabs-aiflow.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
+ # General variables, use default values, which can be set in HF settings
11
  ARG POSTGRES_USER=n8n
12
  ARG POSTGRES_PASSWORD=n8n
13
  ARG POSTGRES_DB=n8n
 
15
  ARG DB_IMPORT=yes
16
  ARG NODEJS_VER=20
17
 
18
+ # Set environment variables, use default values
19
  ENV POSTGRES_USER=${POSTGRES_USER} \
20
  POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \
21
  POSTGRES_DB=${POSTGRES_DB} \
 
41
  WORKDIR=${WORKDIR} \
42
  PATH="$WORKDIR/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
43
 
44
+ # Copy files
45
  COPY requirements.txt ${WORKDIR}/requirements.txt
46
  COPY package.txt ${WORKDIR}/package.txt
47
 
48
+ # Install dependencies
49
  RUN apt-get update && apt-get install -y \
50
  curl unzip gnupg build-essential sudo vim git procps lsof net-tools \
51
  ca-certificates openssl tzdata python3 python3-venv python3-pip gosu \
 
60
  $VIRTUAL_ENV/bin/pip install -r ${WORKDIR}/requirements.txt && \
61
  npm install -g $(cat ${WORKDIR}/package.txt)
62
 
63
+ # Set working directory
64
  WORKDIR ${WORKDIR}
65
+
66
+ # Copy scripts
67
  COPY run.sh ${WORKDIR}/run.sh
68
  COPY import-db.sh ${WORKDIR}/import-db.sh
69
  COPY backup.sh ${WORKDIR}/backup.sh
70
 
71
+ # Make scripts executable
72
  RUN chmod +x ${WORKDIR}/run.sh ${WORKDIR}/import-db.sh ${WORKDIR}/backup.sh
73
 
74
+ # Set user and permissions
75
  USER root
76
  RUN usermod -u 1000 postgres && groupmod -g 1000 postgres && \
77
  chown -R postgres:postgres /var/lib/postgresql /var/run/postgresql ${WORKDIR} && \
78
  mkdir -p ${WORKDIR}/backups && chmod -R 775 ${WORKDIR}/backups
79
 
80
+ # Switch to postgres user
81
  USER postgres
82
 
83
+ # Expose port
84
  EXPOSE 7860
85
 
86
+ # Run command
87
+ CMD./run.sh