How to view dot files (hidden files) in the base directory of a Docker container

2.2k views Asked by At

I have a Lucee app running in Commandbox in a Docker container on Centos 7.

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

The application code is copied to the /app directory at startup via the Dockerfile:

COPY . /app

I would like to view a dot file (hidden file) in the /app directory, /app/.build.

If I browse to http://app_name.com/.build, I get a 404 error (Not Found).

If I rename the file to build.json by the following command:

cp .build build.json

then I can view it via http://app_name.com/build.json

I've tried making the following entry in the server.json file:

"rewrites":{
    "enable":true,
    "config":"customRewrites.xml"
},

And the following rule in the customRewrites.xml file:

<rule>
    <from>\.build$</from>
    <set type="content-type">text-html</set>
    <to last="true">\.build</to>
</rule>

Adding the complete Dockerfile for more clarity:

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

After some further investigation, I found that the problem seems to be that the /usr/local/lib/serverHome/WEB-INF/urlrewrite.xml file is not being created at startup. The logs during startup indicate that the rewrites are being read: --urlrewrite-enable true --urlrewrite-file /app/customRewrites.xml

1

There are 1 answers

0
Randy Welling On

What I have found that the urlRewrite.xml file that comes as a default in Commandbox 5.2 has the following code that blocks hidden files:

<rule>
    <condition type="request-uri" operator="equal">.*/\..*</condition>
    <from>^/(.+)$</from>
    <set type="status">404</set>
    <to type="passthrough" last="true">/404.html</to>
</rule>