hijnu commited on
Commit
7eb48da
1 Parent(s): ffb1970

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -10
Dockerfile CHANGED
@@ -48,7 +48,7 @@ COPY package.txt ${WORKDIR}/package.txt
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 \
51
- htop jq wget lftp cron && \
52
  curl -fsSL https://deb.nodesource.com/setup_${NODEJS_VER}.x | bash - && \
53
  apt-get install -y nodejs && \
54
  ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
@@ -68,16 +68,11 @@ 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,设置备份目录和 crontab 目录权限
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
- chmod 1730 /var/spool/cron/crontabs
77
-
78
- # 设置定期备份任务:每4小时运行一次备份任务
79
- RUN echo "0 */1 * * * /app/backup.sh" > /etc/cron.d/backup && \
80
- chmod 0644 /etc/cron.d/backup && crontab /etc/cron.d/backup
81
 
82
  # 切换到 postgres 用户
83
  USER postgres
@@ -85,5 +80,5 @@ USER postgres
85
  # 暴露 n8n 服务端口
86
  EXPOSE 7860
87
 
88
- # 启动 cron 服务和运行脚本
89
- CMD service cron start && ./run.sh
 
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 \
51
+ htop jq && \
52
  curl -fsSL https://deb.nodesource.com/setup_${NODEJS_VER}.x | bash - && \
53
  apt-get install -y nodejs && \
54
  ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
 
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
 
80
  # 暴露 n8n 服务端口
81
  EXPOSE 7860
82
 
83
+ # 运行脚本
84
+ CMD ./run.sh