我希望在启用了Lua模块的情况下为nginx提供精简的Docker镜像.如何基于Alpine linux创建这个?
解决方法:
这是一个Dockerfile:
FROM alpine:3.6
RUN apk add --no-cache nginx-mod-http-lua
# Delete default config
RUN rm -r /etc/nginx/conf.d && rm /etc/nginx/nginx.conf
# Create folder for PID file
RUN mkdir -p /run/nginx
# Add our nginx conf
COPY ./nginx.conf /etc/nginx/nginx.conf
CMD ["nginx"]
安装nginx-mod-http-lua软件包也会安装nginx和luajit等.
nginx.conf应至少包含以下内容:
load_module /usr/lib/nginx/modules/ndk_http_module.so;
load_module /usr/lib/nginx/modules/ngx_http_lua_module.so;
pcre_jit on;
events {
worker_connections 1024;
}
daemon off;