Adding Lucee Extensions to your Docker Image

How to add extensions to our Lucee Docker Images

Posted by Mark Drew on July 25, 2022

Tagged under lucee,extensions,docker,build

In the previous post, we added a password for Lucee admin, but to do so we needed to backtrack our changes in using lucee-light, back to the full version of Lucee.

So that we can keep the image size down AND add an administrator, we can install just the extension(s) we need. In this case, we will install the Lucee Administrator Extension, you can see it here:

In the previous posts, you have seen me use the ADD command in the Dockerfile. This is a shortcut to adding any file from either your local machine or the internet. The command COPY is generally seen as the way to get files into your docker image but ADD is very useful when we want to, well, add a file via a URL. There are reasons NOT to use ADD since it adds a layer where you could do it all in one RUN command (see but since we are doing a multi-stage build it doesn’t matter in this case.

Let’s look at the changes in the Dockerfile

FROM alpine as base
RUN apk add openjdk11-jre
ADD${LUCEE_VERSION}.jar lucee-light.jar
RUN mkdir /lucee && \
     unzip -d /lucee && \
     chmod +x /lucee/*.sh && \
     chmod +x /lucee/bin/*.sh && \
     rm -f && \
     rm -rf /lucee/__MACOSX && \
     mv lucee-light.jar /lucee/lib/ext/lucee.jar && \
     mkdir -p /lucee/lucee-server/context/ && \
     mkdir -p /lucee/lucee-server/deploy/
RUN echo ${LUCEE_PASSWORD} > /lucee/lucee-server/context/password.txt 
# Add the admin extension
ADD /lucee/lucee-server/deploy/lucee.admin.extension-
COPY webroot /lucee/webapps/ROOT

FROM alpine
RUN apk add openjdk11-jre
COPY --from=base /lucee /lucee
ENTRYPOINT [ "/lucee/" ]ok at the changes in the Dockerfile:

We are still installing everything as usual, but the two additions are:
mkdir -p /lucee/lucee-server/deploy/ where we create the deployment directory (since lucee hasn’t started up yet and had a chance to create the folder)

And our addition of the Lucee Admin extension via:
ADD /lucee/lucee-server/deploy/lucee.admin.extension-

Now when lucee starts up with LUCEE_ENABLE_WARMUP=true it will expand it’s files AND extract the extension for us. Once all this is done we move everything back into our final layer and we are ready to rock. And we are now back to a more comfortable 239MB

In this post, I explained how we can install an admin extension, but you can then add all the specific extensions you need for your specific build. You can see a list of useful extensions here:

NB: There is another way to add the extensions you need, and that is to have LUCEE_EXTENSIONS environment variable, but this would be a list of the UUIDs of each extension which works great but doesn’t really show you the version information easily.

comments powered by Disqus