diff --git a/Dockerfile b/Dockerfile index e1b399f..ab39bef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,26 @@ -# Using maven with JDK 8 -FROM maven:3.6.1-jdk-8 AS build +FROM hapiproject/hapi:base as build-hapi -# Copy pom and download dependencies. This is done here -# so that docker caches the dependencies and they don't have to be -# re-downloaded on the next run, unless the pom file changes. -COPY pom.xml . -RUN /usr/local/bin/mvn-entrypoint.sh mvn verify clean --fail-never +ARG HAPI_FHIR_URL=https://github.com/jamesagnew/hapi-fhir/ +ARG HAPI_FHIR_BRANCH=master +ARG HAPI_FHIR_STARTER_URL=https://github.com/hapifhir/hapi-fhir-jpaserver-starter/ +ARG HAPI_FHIR_STARTER_BRANCH=master -# Copy all of the source code to the image and build it -COPY . . -RUN mvn package +RUN git clone --branch ${HAPI_FHIR_BRANCH} ${HAPI_FHIR_URL} +WORKDIR /tmp/hapi-fhir/ +RUN /tmp/apache-maven-3.6.2/bin/mvn dependency:resolve +RUN /tmp/apache-maven-3.6.2/bin/mvn install -DskipTests -FROM jetty:9-jre8-alpine +WORKDIR /tmp +RUN git clone --branch ${HAPI_FHIR_STARTER_BRANCH} ${HAPI_FHIR_STARTER_URL} -COPY --from=build ./target/hapi-fhir-jpaserver.war /var/lib/jetty/webapps/hapi-fhir-jpaserver.war +WORKDIR /tmp/hapi-fhir-jpaserver-starter +RUN /tmp/apache-maven-3.6.2/bin/mvn clean install -DskipTests -# Copy the default config file to the config directory location. It might be overridden by the docker host. -COPY --from=build ./src/main/resources/hapi.properties /hapi-config/hapi.properties +FROM tomcat:9-jre11 + +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/ -USER jetty:jetty EXPOSE 8080 -CMD ["java","-Dhapi.properties=/hapi-config/hapi.properties","-jar","/usr/local/jetty/start.jar"] \ No newline at end of file + +CMD ["catalina.sh", "run"] \ No newline at end of file diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..d12c086 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,13 @@ +FROM ubuntu + +ENV PATH="/tmp/apache-maven-3.6.0/bin:${PATH}" + +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://www-us.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz && tar xzf apache-maven-3.6.2-bin.tar.gz +RUN export PATH=/tmp/apache-maven-3.6.2/bin:${PATH} \ No newline at end of file diff --git a/docker-build.bat b/docker-build.bat new file mode 100644 index 0000000..fab0cec --- /dev/null +++ b/docker-build.bat @@ -0,0 +1 @@ +docker build --tag hapiproject/hapi:latest --tag hapiproject/hapi:4.1 -m 4g . \ No newline at end of file