librespeed / Dockerfile
leezhuuu's picture
Update Dockerfile
80c8e65 verified
# 使用官方的 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 \
/var/run/nginx && \
chown -R nginx:nginx /var/cache/nginx /var/run/nginx
# 切换到非 root 用户
USER nginx
# 暴露端口
EXPOSE 8080
# 启动 nginx
CMD ["nginx", "-g", "daemon off;"]