File size: 799 Bytes
24a2280
 
e1263f5
 
 
 
24a2280
 
17e1a74
24a2280
 
51ba728
24a2280
4fb77f9
17e1a74
e8f0f14
81aaed9
 
 
 
 
e8f0f14
 
 
 
 
e1263f5
c45813c
e1263f5
24a2280
 
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
# 使用官方的 nginx 镜像作为基础镜像
FROM nginx:alpine

# 设置时区环境变量
ENV TZ=Asia/Shanghai

# 安装必要的软件包
RUN apk add --no-cache curl

# 下载 librespeed 前端文件
RUN curl -L https://github.com/librespeed/speedtest/archive/refs/tags/5.4.1.tar.gz | tar xz -C /usr/share/nginx/html --strip-components=1

# 设置 nginx 配置
COPY default.conf /etc/nginx/conf.d/default.conf

# 创建必要的目录并设置权限
RUN mkdir -p /var/cache/nginx/client_temp \
    /var/cache/nginx/proxy_temp \
    /var/cache/nginx/fastcgi_temp \
    /var/cache/nginx/uwsgi_temp \
    /var/cache/nginx/scgi_temp && \
    chown -R nginx:nginx /var/cache/nginx

# 切换到非 root 用户
USER nginx

# 暴露端口
EXPOSE 8080

# 启动 nginx
CMD ["nginx", "-g", "daemon off;"]