Under a normal Lucee installation we have the WEB-INF folder under the web root where we can find obfuscated lucee code and we can use these code to provide a degree of source code protection if we so choose. But for Lucee on docker, how can we achieve this same goal?
As usual your question is so vague as to be nonsensical and unanswerable.
If you want to provide source to the lucee container, you either ADD/COPY it in in the build, or mount a volume.
If you want to persist WEB-INF, you either ADD/COPY it in in the build, or mount a volume.
The technology doesn’t change anything. Nor is it a lucee question.
If you had a server with lucee4 on it, how would you do what you want? Do you have a set of pre-generated source classes such that you can drop them into WEB-INF and NOT copy anything into /var/www? Otherwise, you’re just distributing your source AND some obfuscated classes. So… what process would you go through if it weren’t docker? If you don’t know that, then ask that question. “How do I distribute precompiled or obfuscated source with lucee 4?” Recognizing that Lucee 4.5 in this container is from August of 2018.
Which shows all the steps to build the image, leaving nothing out.
Including things like this:
# lucee first time startup; explodes lucee and installs bundles/extensions
RUN /usr/local/tomcat/bin/catalina.sh start && \
while [ ! -f "/opt/lucee/web/logs/application.log" ] ; do sleep 2; done && \
Which show you a technique to pre-warm the image.
So… again, if it weren’t a container, what would you do?
The WEB-INF folder would have corresponding directory for each web application directory.
They contain corresponding files such as
index.cfm -> index_cfm$cf.class
and I can simply rename the index_cfm$cf.class back to index.cfm and place the newly renamed index.cfm (osf) in a temp directory, then, rename or remove the index.cfm source file and place the index.cfm (osf) in the application directory. It works.
That’s what I want for my applications on Lucee with Docker.
You’re right my question were not well formed. I appreciate your detailed writing.
Then all you really need to do is change what files you’re copying into your container. Put the precompiled .cfm’s in /var/www.
So it’s not a docker problem at all and has nothing to do with writing into WEB-INF.
Either manually or through CI, you’re going to need to capture those class files and rename them to the appropriate cfms, and then copy THOSE files into your deployable container instead of the original source files.
Another thing you can do from the lucee web admin is create a mapping that points to the root of your application and create an archive without the codde. Then map that archive to the root of your site and use that.
Precompiles everything and it can be done fairly simply (unless cfml-compiler is doing that already)
there are posts buried in the forum about grabbing these out of your container while running in the development environment
what I do is run the container local, open a shell into the container (docker exec -it containerid bash) and scp the config files locally and have docker install them during the build
also since usually we’re using docker to isolate each container into separate lucee instances rather than multiple projects on one container… we just put our configs on the server since /WEB-INF is auto generated from the server configs
@mafimo I don’t believe the original post had anything to do with config files, but rather compiled source code. I would highly recommend you check into the CFConfig CLI to help you manage your configuration on a much more granular level than copying XML files.