FROM docker.1ms.run/openresty/openresty:1.27.1.2-4-alpine-fat

# 安装必要的软件包并清理缓存
RUN opm install spacewander/luafilesystem
RUN rm /usr/local/openresty/nginx/conf/nginx.conf

# 复制配置文件和脚本
COPY detect_mime_by_magic.lua /usr/local/openresty/lualib/
COPY nginx.conf /usr/local/openresty/nginx/conf/

# 创建日志文件并设置权限
RUN touch /usr/local/openresty/nginx/logs/access.log && chmod 777 /usr/local/openresty/nginx/logs/access.log && \
    touch /usr/local/openresty/nginx/logs/error.log && chmod 777 /usr/local/openresty/nginx/logs/error.log && \
    ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log && ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log

# 启动openresty服务
CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]


