Update Dockerfile

Added caching of maven dependency resolving
This commit is contained in:
Jens Kristian Villadsen
2020-08-15 22:54:06 +02:00
committed by GitHub
parent af6bd69db0
commit 47f72cd3b5

View File

@@ -1,27 +1,13 @@
FROM ubuntu as build-hapi
ENV PATH="/tmp/apache-maven-3.6.0/bin:${PATH}"
ENV TZ=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
WORKDIR /tmp
RUN apt-get update && \
apt-get install git -y && \
apt-get install sed -y && \
apt-get install wget -y && \
apt-get install openjdk-11-jdk -y
RUN wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz && tar xzf apache-maven-3.6.3-bin.tar.gz
RUN export PATH=/tmp/apache-maven-3.6.3/bin:${PATH}
FROM maven:3.6.3-jdk-11-slim as build-hapi
WORKDIR /tmp/hapi-fhir-jpaserver-starter
COPY . .
COPY pom.xml .
RUN mvn dependency:go-offline
RUN /tmp/apache-maven-3.6.3/bin/mvn clean install -DskipTests
COPY src/ /tmp/hapi-fhir-jpaserver-starter/src/
RUN mvn clean install -DskipTests
FROM tomcat:9-jre11
FROM tomcat:9.0.37-jdk11-openjdk-slim-buster
RUN mkdir -p /data/hapi/lucenefiles && chmod 775 /data/hapi/lucenefiles
COPY --from=build-hapi /tmp/hapi-fhir-jpaserver-starter/target/*.war /usr/local/tomcat/webapps/