# 使用curlimages/curl作为基础镜像（自带curl和sh）
FROM curlimages/curl:latest

# 切换到root用户进行设置
USER root

# 设置下载目录
WORKDIR /app

# 复制更新脚本
COPY auto_update.sh /app/

# 设置脚本可执行权限
RUN chmod +x /app/auto_update.sh

# 构建时下载初始版本
RUN sh /app/auto_update.sh OnlyUpdate

# 暴露3000端口
EXPOSE 3000

# 设置工作目录
WORKDIR /data

# 启动命令 - 容器启动时检测更新并启动服务
CMD ["sh", "/app/auto_update.bash"]
