ACRoot commited on
Commit
907e009
·
verified ·
1 Parent(s): 45b0da7

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ghcr.io/senshinya/moontv:latest
2
+
3
+ # 切换到 root 用户以进行权限调整
4
+ USER root
5
+
6
+ # 安装 curl 用于下载文件(如果基础镜像没有)
7
+ RUN apk add --no-cache curl
8
+
9
+ ARG CONFIG_URL
10
+
11
+ # 备份或删除原配置文件
12
+ RUN if [ -f /app/config.json ]; then mv /app/config.json /app/config.json.bak; fi
13
+
14
+ # 下载并替换配置文件,使用 CONFIG_URL 变量
15
+ RUN if [ -n "$CONFIG_URL" ]; then \
16
+ curl -Lo /app/config.json "$CONFIG_URL"; \
17
+ else \
18
+ echo "CONFIG_URL is not set. Skipping configuration file download."; \
19
+ fi
20
+
21
+ # 确保文件权限正确
22
+ #RUN chown nextjs:nodejs /app/config.json
23
+
24
+ RUN ls -l /app
25
+
26
+ # 7. 保持工作目录正确(与原镜像一致)
27
+ WORKDIR /app
28
+
29
+ ENV NODE_ENV=production
30
+ ENV PORT=3000
31
+ ENV DOCKER_ENV=true
32
+
33
+ # 切换回非特权用户
34
+ USER nextjs