hijnu commited on
Commit
5272f57
·
verified ·
1 Parent(s): 96fc087

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -9
Dockerfile CHANGED
@@ -52,33 +52,32 @@ RUN apt-get update && apt-get install -y \
52
  # 安装 rclone
53
  curl https://rclone.org/install.sh | bash && \
54
  # 清理 apt 缓存
55
- apt-get clean && rm -rf /var/lib/apt/lists/*
56
-
57
- # 设置 Python 虚拟环境
58
- RUN python3 -m venv $VIRTUAL_ENV && \
59
  $VIRTUAL_ENV/bin/pip install --upgrade pip && \
60
  $VIRTUAL_ENV/bin/pip install ${PYTHON_PACKAGES}
61
 
62
  # 设置工作目录并复制启动脚本
63
  WORKDIR ${WORKDIR}
64
  COPY run.sh ${WORKDIR}/run.sh
65
- COPY import-db.sh /docker-entrypoint-initdb.d/
66
- RUN chmod +x ${WORKDIR}/run.sh /docker-entrypoint-initdb.d/import-db.sh
67
 
68
  # 更改现有的 postgres 用户 UID 和 GID 为 1000
69
  USER root
70
  RUN usermod -u 1000 postgres && groupmod -g 1000 postgres && \
71
  chown -R postgres:postgres /var/lib/postgresql && \
72
  chown -R postgres:postgres /var/run/postgresql && \
73
- chown -R postgres:postgres $WORKDIR && \
74
- mkdir -p $WORKDIR/backups && chmod -R 775 $WORKDIR/backups
75
 
76
  # 切换到 postgres 用户
77
  USER postgres
78
 
79
  # 健康检查配置
80
  HEALTHCHECK --interval=120s --timeout=10s --start-period=10s --retries=3 \
81
- CMD curl -f http://localhost:7860/HEALTHZ || exit 1
82
 
83
  # 启动容器时执行 run.sh 脚本
84
  CMD ["./run.sh"]
 
52
  # 安装 rclone
53
  curl https://rclone.org/install.sh | bash && \
54
  # 清理 apt 缓存
55
+ apt-get clean && rm -rf /var/lib/apt/lists/* && \
56
+ # 设置 Python 虚拟环境
57
+ python3 -m venv $VIRTUAL_ENV && \
 
58
  $VIRTUAL_ENV/bin/pip install --upgrade pip && \
59
  $VIRTUAL_ENV/bin/pip install ${PYTHON_PACKAGES}
60
 
61
  # 设置工作目录并复制启动脚本
62
  WORKDIR ${WORKDIR}
63
  COPY run.sh ${WORKDIR}/run.sh
64
+ COPY import-db.sh ${WORKDIR}/import-db.sh
65
+ RUN chmod +x ${WORKDIR}/run.sh ${WORKDIR}/import-db.sh
66
 
67
  # 更改现有的 postgres 用户 UID 和 GID 为 1000
68
  USER root
69
  RUN usermod -u 1000 postgres && groupmod -g 1000 postgres && \
70
  chown -R postgres:postgres /var/lib/postgresql && \
71
  chown -R postgres:postgres /var/run/postgresql && \
72
+ chown -R postgres:postgres ${WORKDIR} && \
73
+ mkdir -p ${WORKDIR}/backups && chmod -R 775 ${WORKDIR}/backups
74
 
75
  # 切换到 postgres 用户
76
  USER postgres
77
 
78
  # 健康检查配置
79
  HEALTHCHECK --interval=120s --timeout=10s --start-period=10s --retries=3 \
80
+ CMD pg_isready && curl -f http://localhost:7860/HEALTHZ || exit 1
81
 
82
  # 启动容器时执行 run.sh 脚本
83
  CMD ["./run.sh"]