添加复制和下载按钮,统计字数功能
This commit is contained in:
50
Dockerfile
Normal file
50
Dockerfile
Normal file
@@ -0,0 +1,50 @@
|
||||
# 极简静态资源镜像
|
||||
FROM nginx:alpine
|
||||
|
||||
# 安装 wget 用于健康检查
|
||||
RUN apk add --no-cache wget
|
||||
|
||||
# 极简静态资源镜像
|
||||
FROM nginx:alpine
|
||||
|
||||
# 安装 wget 用于健康检查
|
||||
RUN apk add --no-cache wget
|
||||
|
||||
# 创建自定义 nginx 配置,禁用缓存并确保正确读取挂载目录
|
||||
RUN printf 'server {\n\
|
||||
listen 80;\n\
|
||||
server_name localhost;\n\
|
||||
root /usr/share/nginx/html;\n\
|
||||
index index.html index.htm;\n\
|
||||
\n\
|
||||
# 禁用缓存\n\
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";\n\
|
||||
add_header Pragma "no-cache";\n\
|
||||
add_header Expires "0";\n\
|
||||
\n\
|
||||
location / {\n\
|
||||
try_files $uri $uri/ /index.html;\n\
|
||||
# 确保每次都读取最新文件\n\
|
||||
sendfile off;\n\
|
||||
tcp_nodelay on;\n\
|
||||
tcp_nopush off;\n\
|
||||
}\n\
|
||||
\n\
|
||||
# 禁用所有静态文件缓存\n\
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {\n\
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";\n\
|
||||
add_header Pragma "no-cache";\n\
|
||||
add_header Expires "0";\n\
|
||||
}\n\
|
||||
}\n' > /etc/nginx/conf.d/default.conf
|
||||
|
||||
# 确保挂载目录存在但为空(避免与外部挂载冲突)
|
||||
RUN mkdir -p /usr/share/nginx/html && \
|
||||
rm -rf /usr/share/nginx/html/* && \
|
||||
echo "Waiting for external mount..." > /usr/share/nginx/html/.placeholder
|
||||
|
||||
# 暴露静态服务端口
|
||||
EXPOSE 80
|
||||
|
||||
# 启动 nginx 前台运行
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user