# ---- 基础镜像 ---- | |
FROM alpine:3.20 | |
# ---- 运行时所需依赖 ---- | |
# 1. ca-certificates = HTTPS 证书 | |
# 2. tzdata = 时区数据库 | |
# 3. curl = 下载二进制文件(比 wget 更常见于 Alpine) | |
RUN apk add --no-cache ca-certificates tzdata curl | |
# ---- 设置时区 ---- | |
ENV TZ=Asia/Shanghai | |
# 把时区软链接到 /etc/localtime,并写入 /etc/timezone,tzdata 包已提供完整 zoneinfo | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ | |
echo $TZ > /etc/timezone | |
# ---- 安装 OpenList ---- | |
WORKDIR /opt/openlist | |
# 单行完成:下载 → 解压 → 删除压缩包 → 授予执行权限 | |
RUN curl -L -o openlist.tar.gz \ | |
https://github.com/OpenListTeam/OpenList/releases/download/beta/openlist-linux-amd64.tar.gz && \ | |
tar -xzf openlist.tar.gz && \ | |
rm openlist.tar.gz && \ | |
chmod +x openlist | |
# ---- 暴露端口(假设 OpenList 默认用 5244,可按需修改)---- | |
EXPOSE 5244 | |
# ---- 入口 ---- | |
CMD ["./openlist", "server"] | |