MoonTV / Dockerfile
arronlx's picture
Update Dockerfile
7573685 verified
raw
history blame contribute delete
902 Bytes
FROM ghcr.io/senshinya/moontv:latest
# 切换到 root 用户以进行权限调整
USER root
# 安装 curl 用于下载文件(如果基础镜像没有)
RUN apk add --no-cache curl
ARG CONFIG_URL
# 创建public目录并设置权限
RUN mkdir -p /app/public && chmod -R 777 /app/public
# 备份或删除原配置文件
RUN if [ -f /app/config.json ]; then mv /app/config.json /app/config.json.bak; fi
# 下载并替换配置文件,使用 CONFIG_URL 变量
RUN if [ -n "$CONFIG_URL" ]; then \
curl -Lo /app/config.json "$CONFIG_URL"; \
else \
echo "CONFIG_URL is not set. Skipping configuration file download."; \
fi
# 确保文件权限正确
#RUN chown nextjs:nodejs /app/config.json
RUN ls -l /app
# 7. 保持工作目录正确(与原镜像一致)
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
ENV DOCKER_ENV=true
# 切换回非特权用户
USER nextjs