Updating Dockerfile to build the app from the ground up
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -1,23 +1,26 @@
|
|||||||
# Using maven with JDK 8
|
FROM hapiproject/hapi:base as build-hapi
|
||||||
FROM maven:3.6.1-jdk-8 AS build
|
|
||||||
|
|
||||||
# Copy pom and download dependencies. This is done here
|
ARG HAPI_FHIR_URL=https://github.com/jamesagnew/hapi-fhir/
|
||||||
# so that docker caches the dependencies and they don't have to be
|
ARG HAPI_FHIR_BRANCH=master
|
||||||
# re-downloaded on the next run, unless the pom file changes.
|
ARG HAPI_FHIR_STARTER_URL=https://github.com/hapifhir/hapi-fhir-jpaserver-starter/
|
||||||
COPY pom.xml .
|
ARG HAPI_FHIR_STARTER_BRANCH=master
|
||||||
RUN /usr/local/bin/mvn-entrypoint.sh mvn verify clean --fail-never
|
|
||||||
|
|
||||||
# Copy all of the source code to the image and build it
|
RUN git clone --branch ${HAPI_FHIR_BRANCH} ${HAPI_FHIR_URL}
|
||||||
COPY . .
|
WORKDIR /tmp/hapi-fhir/
|
||||||
RUN mvn package
|
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.
|
FROM tomcat:9-jre11
|
||||||
COPY --from=build ./src/main/resources/hapi.properties /hapi-config/hapi.properties
|
|
||||||
|
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
|
EXPOSE 8080
|
||||||
CMD ["java","-Dhapi.properties=/hapi-config/hapi.properties","-jar","/usr/local/jetty/start.jar"]
|
|
||||||
|
CMD ["catalina.sh", "run"]
|
||||||
13
Dockerfile.base
Normal file
13
Dockerfile.base
Normal file
@@ -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}
|
||||||
1
docker-build.bat
Normal file
1
docker-build.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
docker build --tag hapiproject/hapi:latest --tag hapiproject/hapi:4.1 -m 4g .
|
||||||
Reference in New Issue
Block a user