anchor.diff:  # See the License for the specific language governing permissions and
   # limitations under the License.
   #
  -FROM gradle:jdk11
   
  -EXPOSE 9999
  +# Image that can build items
  +FROM gradle:jdk11 AS builder
  +
  +# Build everything we need
  +ADD src /home/gradle/src
  +ADD build.gradle /home/gradle/build.gradle
  +RUN mkdir -p .gradle && \
  +    echo "org.gradle.daemon=false" >> .gradle/gradle.properties && \
  +    gradle build
  +
  +# The items service image
  +FROM openjdk:11-jre
   
   ENV ITEMS_HOME=/opt/items
  -
  -USER root
  -
  -# Build everything we need
  -ADD src ${ITEMS_HOME}/src
  -ADD build.gradle ${ITEMS_HOME}/build.gradle
  -ENV GRADLE_USER_HOME=${ITEMS_HOME}
  -WORKDIR ${ITEMS_HOME}
  -RUN mkdir -p "${ITEMS_HOME}/.gradle" && \
  -    echo "org.gradle.daemon=false" >> \
  -        ${ITEMS_HOME}/.gradle/gradle.properties && \
  -    gradle build
  -RUN mkdir -p ${ITEMS_HOME}/lib && \
  -    cp build/libs/items.jar ${ITEMS_HOME}/lib/items.jar && \
  -    rm -rf build .gradle
  +COPY --from=builder /home/gradle/build/libs/items.jar \
  +                    ${ITEMS_HOME}/lib/items.jar
   
   # Set up the runtime environment
   RUN mkdir -p ${ITEMS_HOME}/var
  
positive.code: ADD items ${ITEMS_HOME}/items
  
  # Set the runtime user
  RUN useradd --system --home ${ITEMS_HOME} items
  RUN chown -R items ${ITEMS_HOME}
  
  # Run the service
  USER items
  CMD ${ITEMS_HOME}/items --jar "${ITEMS_HOME}/lib/items.jar"
  
negative.code: #
  # Copyright 2016, 2020, Matt Dean
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  