【发布时间】:2021-02-25 19:19:07
【问题描述】:
我有一个 Lucee 应用程序在 Centos 7 上的 Docker 容器中的 Commandbox 中运行。
Docker version 1.13.1, build 0be3e21/1.13.1
CentOS Linux release 7.9.2009 (Core)
Commandbox v5.2.1+00295
Lucee 5.3.7.47
应用程序代码在启动时通过Dockerfile复制到/app目录:
COPY . /app
我想查看/app目录/app/.build中的一个点文件(隐藏文件)。
如果我浏览到 http://app_name.com/.build,我会收到 404 错误(未找到)。
如果我通过以下命令将文件重命名为 build.json:
cp .build build.json
然后我可以通过 http://app_name.com/build.json 查看它
我尝试在 server.json 文件中创建以下条目:
"rewrites":{
"enable":true,
"config":"customRewrites.xml"
},
以及customRewrites.xml文件中的如下规则:
<rule>
<from>\.build$</from>
<set type="content-type">text-html</set>
<to last="true">\.build</to>
</rule>
添加完整的 Dockerfile 更清晰:
FROM ortussolutions/commandbox
COPY . /app
COPY ./config/ /config/
ENV LUCEE_EXTENSIONS D4EDFDBD-A9A3-E9AF-597322D767E0C949;name=Oracle;version=11.2.0.4
WORKDIR $APP_DIR
RUN box install
经过进一步调查,我发现问题似乎是在启动时没有创建 /usr/local/lib/serverHome/WEB-INF/urlrewrite.xml 文件。启动期间的日志表明正在读取重写: --urlrewrite-启用真 --urlrewrite-file /app/customRewrites.xml
【问题讨论】:
-
可以添加 Dockerfile 吗?
-
为了清晰起见,我添加了完整的 Dockerfile,感谢您的提问:
-
你是否在 docker 容器内执行了这个命令
cp .build build.json?我的意思是您是否检查了文件.build是否已复制到 docker 容器中? -
你确定来自
customRewrites.xml文件的语法吗?你能看看here。 -
奥马尔,我确实检查了 Docker 容器中是否存在文件 当前的 Docker 容器名称是 "d97aaa01fd38" root@d97aaa01fd38:/app# pwd /app root@d97aaa01fd38:/app# ls -la |grep 构建 -rw-r--r--。 1 根 152 Feb 23 21:15 .build -rw-r--r--。 1 根根 152 Feb 23 21:15 build.json
标签: docker lucee commandbox