xref: /OpenGrok/Dockerfile (revision ddb2897e82001369e7d6748a2634359cc846f672)
16670a14aSVladimir KotalFROM debian:stable-slim as fetcher
26670a14aSVladimir Kotal
36670a14aSVladimir Kotal# TODO copy just the 'distribution' directory, not all source code
46670a14aSVladimir KotalCOPY ./ /opengrok-source
56670a14aSVladimir KotalWORKDIR /opengrok-source
66670a14aSVladimir Kotal
76670a14aSVladimir Kotal# update the system
86670a14aSVladimir KotalRUN apt-get update
96670a14aSVladimir Kotal
106670a14aSVladimir Kotal# find most recent package file
116670a14aSVladimir KotalRUN cp `ls -t distribution/target/*.tar.gz | head -n1 |awk '{printf("%s",$0)}'` /opengrok.tar.gz
126670a14aSVladimir Kotal
136670a14aSVladimir KotalFROM tomcat:9-jre8
146670a14aSVladimir KotalLABEL maintainer "opengrok-dev@yahoogroups.com"
156670a14aSVladimir Kotal
166670a14aSVladimir Kotal# prepare OpenGrok binaries and directories
176670a14aSVladimir KotalCOPY --from=fetcher opengrok.tar.gz /opengrok.tar.gz
186670a14aSVladimir KotalRUN mkdir -p /opengrok /var/opengrok/etc /opengrok/data /opengrok/src && \
196670a14aSVladimir Kotal    tar -zxvf /opengrok.tar.gz -C /opengrok --strip-components 1 && \
206670a14aSVladimir Kotal    rm -f /opengrok.tar.gz
216670a14aSVladimir Kotal
226670a14aSVladimir Kotal# install dependencies and Python tools
236670a14aSVladimir KotalRUN apt-get update && apt-get install -y git subversion mercurial unzip inotify-tools python3 python3-pip python3-venv && \
246670a14aSVladimir Kotal    python3 -m pip install /opengrok/tools/opengrok-tools*
256670a14aSVladimir Kotal
266670a14aSVladimir Kotal# compile and install universal-ctags
276670a14aSVladimir KotalRUN apt-get install -y pkg-config autoconf build-essential && git clone https://github.com/universal-ctags/ctags /root/ctags && \
286670a14aSVladimir Kotal    cd /root/ctags && ./autogen.sh && ./configure && make && make install && \
296670a14aSVladimir Kotal    apt-get remove -y autoconf build-essential && apt-get -y autoremove && apt-get -y autoclean && \
306670a14aSVladimir Kotal    cd /root && rm -rf /root/ctags
316670a14aSVladimir Kotal
326670a14aSVladimir Kotal# environment variables
336670a14aSVladimir KotalENV SRC_ROOT /opengrok/src
346670a14aSVladimir KotalENV DATA_ROOT /opengrok/data
356670a14aSVladimir KotalENV OPENGROK_WEBAPP_CONTEXT /
366670a14aSVladimir KotalENV OPENGROK_TOMCAT_BASE /usr/local/tomcat
376670a14aSVladimir KotalENV CATALINA_HOME /usr/local/tomcat
386670a14aSVladimir KotalENV CATALINA_BASE /usr/local/tomcat
396670a14aSVladimir KotalENV CATALINA_TMPDIR /usr/local/tomcat/temp
40*ddb2897eSKryštof TulingerENV PATH $CATALINA_HOME/bin:$PATH
416670a14aSVladimir KotalENV JRE_HOME /usr
426670a14aSVladimir KotalENV CLASSPATH /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
436670a14aSVladimir Kotal
446670a14aSVladimir Kotal# custom deployment to / with redirect from /source
456670a14aSVladimir KotalRUN rm -rf /usr/local/tomcat/webapps/* && \
466670a14aSVladimir Kotal    opengrok-deploy /opengrok/lib/source.war /usr/local/tomcat/webapps/ROOT.war && \
476670a14aSVladimir Kotal    mkdir "/usr/local/tomcat/webapps/source" && \
486670a14aSVladimir Kotal    echo '<% response.sendRedirect("/"); %>' > "/usr/local/tomcat/webapps/source/index.jsp"
496670a14aSVladimir Kotal
506670a14aSVladimir Kotal# disable all file logging
516670a14aSVladimir KotalADD docker/logging.properties /usr/local/tomcat/conf/logging.properties
526670a14aSVladimir KotalRUN sed -i -e 's/Valve/Disabled/' /usr/local/tomcat/conf/server.xml
536670a14aSVladimir Kotal
546670a14aSVladimir Kotal# add our scripts
556670a14aSVladimir KotalADD docker /scripts
566670a14aSVladimir KotalRUN chmod -R +x /scripts
576670a14aSVladimir Kotal
586670a14aSVladimir Kotal# run
596670a14aSVladimir KotalWORKDIR $CATALINA_HOME
606670a14aSVladimir KotalEXPOSE 8080
616670a14aSVladimir KotalCMD ["/scripts/start.sh"]
62