Skip to content

Instantly share code, notes, and snippets.

@isapir
Created April 23, 2019 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isapir/8f08ebec9b08dfe763fe057d74781969 to your computer and use it in GitHub Desktop.
Save isapir/8f08ebec9b08dfe763fe057d74781969 to your computer and use it in GitHub Desktop.
## BUILD:
#
# docker build [--build-arg LUCEE_VERSION=5.2.9.37-SNAPSHOT] -t isapir/lucee-52937 .
# docker push isapir/lucee-52937
## RUN:
#
# groupadd -g 8080 --system lucee
# useradd --system -u 8080 lucee -g lucee
# export WEBROOT=/webroot
# chown -R lucee:lucee $WEBROOT
#
# docker container run -d --rm -p 8080:8080 --name lucee-8080 \
# -v $WEBROOT:/srv/www/webapps/ROOT \
# --user lucee:lucee \
# -e LUCEE_PRESERVE_CASE=true \
# isapir/lucee-52937
FROM tomcat:9.0-jre8-alpine
# Set default LUCEE_VERSION
# Override at build time with --build-arg LUCEE_VERSION=5.2.9.37-SNAPSHOT
ARG LUCEE_VERSION=5.2.9.37-SNAPSHOT
ENV LUCEE_VERSION=${LUCEE_VERSION}
# Map a host directory for web root with
# -v <host-web-app-directory>:/srv/www/webapps/ROOT
ENV CATALINA_BASE /srv/www
ENV CATALINA_HOME /usr/local/tomcat
ENV LUCEE_DOWNLOAD http://release.lucee.org/rest/update/provider/loader/
# Add group with gid 8080 and user with uid 8080
RUN addgroup -S -g 8080 lucee \
&& adduser -S -u 8080 lucee lucee
# curl needs the -L switch to follow server redirect
RUN echo Downloading Lucee ${LUCEE_VERSION}... \
&& apk --no-cache add curl \
&& $CATALINA_HOME/bin/makebase.sh $CATALINA_BASE \
&& curl -L -o "${CATALINA_BASE}/lib/${LUCEE_VERSION}.jar" "${LUCEE_DOWNLOAD}${LUCEE_VERSION}"
# copy the files from res/tomcat to the image
COPY res/tomcat ${CATALINA_BASE}
# chwon directories inside the container to lucee:lucee
RUN chown -R lucee:lucee ${CATALINA_HOME} \
&& chown -R lucee:lucee ${CATALINA_BASE}
USER lucee
# warmup to cut down start time; we will not see the output during warmup
# which we limit to 10s
RUN catalina.sh start \
&& sleep 10 \
&& catalina.sh stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment