|
1 |
| -FROM debian:stable-slim as fetcher |
| 1 | +# Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved. |
2 | 2 |
|
3 |
| -# TODO copy just the 'distribution' directory, not all source code |
| 3 | +FROM ubuntu:bionic as build |
| 4 | + |
| 5 | +RUN apt-get update && apt-get install -y openjdk-8-jdk maven python3 python3-venv |
| 6 | + |
| 7 | +# Create a first layer to cache the "Maven World" in the local repository. |
| 8 | +# Incremental docker builds will always resume after that, unless you update the pom |
| 9 | +WORKDIR /mvn |
| 10 | +COPY pom.xml /mvn/ |
| 11 | +COPY opengrok-indexer/pom.xml /mvn/opengrok-indexer/ |
| 12 | +COPY opengrok-web/pom.xml /mvn/opengrok-web/ |
| 13 | +COPY plugins/pom.xml /mvn/plugins/ |
| 14 | +COPY suggester/pom.xml /mvn/suggester/ |
| 15 | + |
| 16 | +# distribution and opengrok-tools do not have dependencies to cache |
| 17 | +RUN sed -i 's:<module>distribution</module>::g' /mvn/pom.xml |
| 18 | +RUN sed -i 's:<module>opengrok-tools</module>::g' /mvn/pom.xml |
| 19 | + |
| 20 | +RUN mkdir -p /mvn/opengrok-indexer/target/jflex-sources |
| 21 | +RUN mkdir -p /mvn/opengrok-web/src/main/webapp |
| 22 | +COPY opengrok-indexer/jflex-tt.txt /mvn/opengrok-indexer/jflex-tt.txt |
| 23 | +COPY opengrok-indexer/jflex-tt-end.txt /mvn/opengrok-indexer/jflex-tt-end.txt |
| 24 | +COPY opengrok-indexer/jflex-code.txt /mvn/opengrok-indexer/jflex-code.txt |
| 25 | +COPY opengrok-indexer/jflex-code-end.txt /mvn/opengrok-indexer/jflex-code-end.txt |
| 26 | +RUN mkdir -p /mvn/opengrok-web/src/main/webapp/WEB-INF/ && touch /mvn/opengrok-web/src/main/webapp/WEB-INF/web.xml |
| 27 | + |
| 28 | +# dummy build to cache the dependencies |
| 29 | +RUN mvn -DskipTests -Dcheckstyle.skip -Dmaven.antrun.skip package |
| 30 | + |
| 31 | +# build the project |
4 | 32 | COPY ./ /opengrok-source
|
5 | 33 | WORKDIR /opengrok-source
|
6 | 34 |
|
7 |
| -# update the system |
8 |
| -RUN apt-get update |
9 |
| - |
10 |
| -# find most recent package file |
11 |
| -RUN cp `ls -t distribution/target/*.tar.gz | head -n1 |awk '{printf("%s",$0)}'` /opengrok.tar.gz |
| 35 | +RUN mvn -DskipTests=true -Dmaven.javadoc.skip=true -B -V package |
| 36 | +RUN cp distribution/target/*.tar.gz /opengrok.tar.gz |
12 | 37 |
|
13 | 38 | FROM tomcat:9-jre8
|
14 |
| -LABEL maintainer "[email protected]" |
15 |
| - |
16 |
| -# prepare OpenGrok binaries and directories |
17 |
| -COPY --from=fetcher opengrok.tar.gz /opengrok.tar.gz |
18 |
| -RUN mkdir -p /opengrok /opengrok/etc /opengrok/data /opengrok/src && \ |
19 |
| - tar -zxvf /opengrok.tar.gz -C /opengrok --strip-components 1 && \ |
20 |
| - rm -f /opengrok.tar.gz |
| 39 | +LABEL maintainer= "[email protected]" |
21 | 40 |
|
22 | 41 | # install dependencies and Python tools
|
23 |
| -RUN apt-get update && apt-get install -y git subversion mercurial unzip inotify-tools python3 python3-pip python3-venv && \ |
24 |
| - python3 -m pip install /opengrok/tools/opengrok-tools* |
| 42 | +RUN apt-get update && apt-get install -y git subversion mercurial unzip inotify-tools python3 python3-pip python3-venv |
25 | 43 |
|
26 | 44 | # compile and install universal-ctags
|
27 | 45 | RUN apt-get install -y pkg-config autoconf build-essential && git clone https://github.com/universal-ctags/ctags /root/ctags && \
|
28 | 46 | cd /root/ctags && ./autogen.sh && ./configure && make && make install && \
|
29 | 47 | apt-get remove -y autoconf build-essential && apt-get -y autoremove && apt-get -y autoclean && \
|
30 | 48 | cd /root && rm -rf /root/ctags
|
31 | 49 |
|
| 50 | +# prepare OpenGrok binaries and directories |
| 51 | +COPY --from=build opengrok.tar.gz /opengrok.tar.gz |
| 52 | +RUN mkdir -p /opengrok /opengrok/etc /opengrok/data /opengrok/src && \ |
| 53 | + tar -zxvf /opengrok.tar.gz -C /opengrok --strip-components 1 && \ |
| 54 | + rm -f /opengrok.tar.gz |
| 55 | + |
| 56 | +RUN python3 -m pip install /opengrok/tools/opengrok-tools* |
| 57 | + |
32 | 58 | # environment variables
|
33 | 59 | ENV SRC_ROOT /opengrok/src
|
34 | 60 | ENV DATA_ROOT /opengrok/data
|
|
0 commit comments