【发布时间】:2021-04-07 22:30:16
【问题描述】:
我遇到了一个 nginx 限制问题,需要我扩展我的 nginx dockerfile 的配置,我发现一个 Dockerfile 扩展逻辑列出了 here 但我无法让它工作,我'不确定我应该为COPY . /app/ 使用什么,因为我不需要将任何内容复制到图像中,我只需要那个魔法脚本 .
这是整个 Dockerfile 供参考
FROM jwilder/nginx-proxy
COPY . /app/
RUN { \
# Increased the number of worker_processes from any number to 4
sed -i 's/\(worker_processes\s*\)[0-9]*;/\14;/' /etc/nginx/nginx.conf; \
# Increased the number of worker_connections from any number to 19000
sed -i 's/\(worker_connections\s*\)[0-9]*;/\119000;/' /etc/nginx/nginx.conf; \
}
删除 COPY 不起作用,构建上下文变得很大(超过 1GB),所以我猜它正在抓取它所在的 repo 中的所有内容。
【问题讨论】:
-
一个选项是在运行映像时使用
docker run -v选项替换配置文件。这不能进行就地编辑——你需要提供一个完整的配置文件——但你也不需要这种方法的自定义图像。 -
the build context just gets huge (over 1GB) so I'm guessing it's grabbing everything in the repo it's in,您可能需要一个.dockerignore 文件 -
@DavidMaze 我知道的没错,我以为它只会“知道”配置哈哈
标签: docker nginx dockerfile jwilder-nginx-proxy