Spaces:
Paused
Paused
File size: 1,285 Bytes
f3410f9 d7b846b f3410f9 6e7df17 42dcb30 876ae09 c6178aa 876ae09 d7b846b c6178aa 876ae09 b73fb73 5f8f3ef 42dcb30 3b301d1 42dcb30 c6178aa 6e7df17 d7b846b 6e7df17 876ae09 64fa5b0 42dcb30 6e7df17 754dab7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # =============================================================================
# Sub2API - 自部署 PostgreSQL + Redis 一体化镜像
# =============================================================================
FROM ghcr.io/wei-shaw/sub2api:latest
# 安装所有必要工具(修正包名:postgresql-server → postgresql)
RUN apk add --no-cache \
python3 \
py3-bcrypt \
redis \
postgresql-client \
postgresql \
postgresql-contrib \
openssl \
tzdata \
su-exec \
wget # 用于健康检查,若基础镜像已有可删除
# 创建软链接,让脚本中的 /app/hub-gateway 指向实际的 /app/sub2api
RUN ln -s /app/sub2api /app/hub-gateway
# 复制自定义启动脚本(覆盖官方默认脚本)
COPY start-space.sh /app/start-space.sh
RUN chmod +x /app/start-space.sh
# 环境变量默认值
ENV SERVER_PORT=7860 \
TZ=Asia/Shanghai \
PGDATA=/var/lib/postgresql/data \
POSTGRES_USER=sub2api \
POSTGRES_DB=sub2api \
POSTGRES_PASSWORD=changeme
# 健康检查(依赖 wget,现已安装)
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=5 \
CMD wget -q -T 5 -O /dev/null http://localhost:${SERVER_PORT:-7860}/health || exit 1
EXPOSE 7860
ENTRYPOINT ["/app/start-space.sh"] |