Skip to content

Commit

Permalink
add Dockerfile and .dockerignore
Browse files Browse the repository at this point in the history
  • Loading branch information
bennsimon committed Apr 7, 2022
1 parent 6b07f07 commit 53bbb85
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/docs/
Dockerfile
*.md
.git
/app/target/
/common/target/
/dhis/target/
/fhir/target/
/fhir-dstu3/target/
/fhir-r4/target/
/metadata-sheet/target/
/summary/target/
/.idea/
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM maven:3-openjdk-8-slim AS build
WORKDIR /tmp/dhis2-fhir-adapter
ARG DHIS2_HOME=/app

COPY . /tmp/dhis2-fhir-adapter

# create package
RUN mvn clean package -DskipTests

# create DHIS2_HOME/services/fhir-adapter configuration folder here https://github.com/opensrp/dhis2-fhir-adapter#configuration
RUN mkdir -p ${DHIS2_HOME}/services/fhir-adapter \
&& cp /tmp/dhis2-fhir-adapter/app/target/dhis2-fhir-adapter.war ${DHIS2_HOME}/main.war

FROM openjdk:8-jdk-slim AS deploy

# specify the DHIS2_HOME environment variable
ENV DHIS2_HOME=/app

# create opensrp user
ARG UID=10001
ARG GID=${UID}
RUN groupadd -g ${GID} opensrp \
&& useradd -u ${UID} -g ${GID} opensrp

COPY --chown=opensrp:opensrp --from=build ${DHIS2_HOME} ${DHIS2_HOME}

USER opensrp

WORKDIR ${DHIS2_HOME}

CMD java -jar ${DHIS2_HOME}/main.war

0 comments on commit 53bbb85

Please sign in to comment.