Commit a54d5ec9 authored by Matt Pryor's avatar Matt Pryor
Browse files

Make a separately cacheable builder image for search as it takes ages

parent 612ca679
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -109,6 +109,13 @@ build:nginx:
    CONTEXT_DIR: $CI_PROJECT_DIR/images/nginx
  needs: ["build:base"]

build:search-builder:
  extends: .docker-build
  stage: build-3
  variables:
    CONTEXT_DIR: $CI_PROJECT_DIR/images/search-builder
  needs: ["build:jdk"]

build:solr:
  extends: .docker-build
  stage: build-3
@@ -128,7 +135,7 @@ build:search:
  stage: build-4
  variables:
    CONTEXT_DIR: $CI_PROJECT_DIR/images/search
  needs: ["build:jdk", "build:tomcat"]
  needs: ["build:search-builder", "build:tomcat"]

build:thredds:
  extends: .docker-build
+47 −0
Original line number Diff line number Diff line
#####
## Image for running THREDDS
#####

ARG ESGF_REPOSITORY_BASE=esgfdeploy
ARG ESGF_IMAGES_VERSION=latest
FROM ${ESGF_REPOSITORY_BASE}/jdk:${ESGF_IMAGES_VERSION}

# Install dependencies
RUN yum makecache && \
    yum install -y git ant ivy && \
    yum clean all

# Build esgf-node-manager
ARG ESGF_NODE_MANAGER_VERSION=15682f64212782a56eacdb356432e9e21d643e1d
RUN git clone https://github.com/ESGF/esgf-node-manager.git /src/esgf-node-manager && \
    pushd /src/esgf-node-manager && \
    git checkout $ESGF_NODE_MANAGER_VERSION && \
    popd
RUN pushd /src/esgf-node-manager && \
    ant clean_all make_dist publish_local && \
    popd

# Build esgf-security
ARG ESGF_SECURITY_VERSION=a510b3f4807a683e34e32ffae11ee45f6481fd59
RUN git clone https://github.com/ESGF/esgf-security.git /src/esgf-security && \
    pushd /src/esgf-security && \
    git checkout $ESGF_SECURITY_VERSION && \
    popd
RUN pushd /src/esgf-security && \
    ant clean_all make_dist publish_local && \
    popd

# # Build esg-search
ARG ESG_SEARCH_VERSION=2cf9496b512bafcd880e4eb573764641c8971655
RUN git clone https://github.com/ESGF/esg-search.git /src/esg-search && \
    pushd /src/esg-search && \
    git checkout $ESG_SEARCH_VERSION && \
    popd
RUN pushd /src/esg-search && \
    ant clean_all make_dist publish_local && \
    popd

# Unpack the esg-search war into /application
RUN mkdir /application && \
    pushd /application && \
    jar xvf /src/esg-search/dist/esg-search.war
+4 −49
Original line number Diff line number Diff line
@@ -5,56 +5,11 @@
ARG ESGF_REPOSITORY_BASE=esgfdeploy
ARG ESGF_IMAGES_VERSION=latest

#####
# Stage 1: Build esg-search and dependencies from GitHub
#####

FROM ${ESGF_REPOSITORY_BASE}/jdk:${ESGF_IMAGES_VERSION} as builder

# Install dependencies
RUN yum makecache && \
    yum install -y git ant ivy && \
    yum clean all

# Build esgf-node-manager
ARG ESGF_NODE_MANAGER_VERSION=15682f64212782a56eacdb356432e9e21d643e1d
RUN git clone https://github.com/ESGF/esgf-node-manager.git /src/esgf-node-manager && \
    pushd /src/esgf-node-manager && \
    git checkout $ESGF_NODE_MANAGER_VERSION && \
    popd
RUN pushd /src/esgf-node-manager && \
    ant clean_all make_dist publish_local && \
    popd

# Build esgf-security
ARG ESGF_SECURITY_VERSION=a510b3f4807a683e34e32ffae11ee45f6481fd59
RUN git clone https://github.com/ESGF/esgf-security.git /src/esgf-security && \
    pushd /src/esgf-security && \
    git checkout $ESGF_SECURITY_VERSION && \
    popd
RUN pushd /src/esgf-security && \
    ant clean_all make_dist publish_local && \
    popd

# # Build esg-search
ARG ESG_SEARCH_VERSION=2cf9496b512bafcd880e4eb573764641c8971655
RUN git clone https://github.com/ESGF/esg-search.git /src/esg-search && \
    pushd /src/esg-search && \
    git checkout $ESG_SEARCH_VERSION && \
    popd
RUN pushd /src/esg-search && \
    ant clean_all make_dist publish_local && \
    popd

# Unpack the esg-search war into /application
RUN mkdir /application && \
    pushd /application && \
    jar xvf /src/esg-search/dist/esg-search.war

#####
# Stage 2: Build runtime image
#####
# Make a reference to the builder
# We have to do this as a FROM because we can't use variables in COPY --from
FROM ${ESGF_REPOSITORY_BASE}/search-builder:${ESGF_IMAGES_VERSION} as builder

# Build the runtime image
FROM ${ESGF_REPOSITORY_BASE}/tomcat:${ESGF_IMAGES_VERSION}

USER root