Skip to content

Commit

Permalink
Update to latest HAPI starter project
Browse files Browse the repository at this point in the history
  • Loading branch information
bstewartlg committed Nov 13, 2024
1 parent 225eb7b commit 7b3fb39
Show file tree
Hide file tree
Showing 101 changed files with 178,074 additions and 4,146 deletions.
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM maven:3.8-openjdk-17-slim AS build-hapi
FROM docker.io/library/maven:3.9.9-eclipse-temurin-17 AS build-hapi
WORKDIR /tmp/hapi-fhir-jpaserver-starter

ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.17.0
ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.33.3
RUN curl -LSsO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OPENTELEMETRY_JAVA_AGENT_VERSION}/opentelemetry-javaagent.jar

COPY pom.xml .
Expand All @@ -12,19 +12,20 @@ COPY src/ /tmp/hapi-fhir-jpaserver-starter/src/
RUN mvn clean install -DskipTests -Djdk.lang.Process.launchMechanism=vfork

FROM build-hapi AS build-distroless
RUN mvn package spring-boot:repackage -Pboot
RUN mvn package -DskipTests spring-boot:repackage -Pboot
RUN mkdir /app && cp /tmp/hapi-fhir-jpaserver-starter/target/ROOT.war /app/main.war


########### bitnami tomcat version is suitable for debugging and comes with a shell
########### it can be built using eg. `docker build --target tomcat .`
FROM bitnami/tomcat:9.0 AS tomcat
FROM bitnami/tomcat:10.1 AS tomcat

USER root
RUN rm -rf /opt/bitnami/tomcat/webapps/ROOT && \
mkdir -p /opt/bitnami/hapi/data/hapi/lucenefiles && \
chown -R 1001:1001 /opt/bitnami/hapi/data/hapi/lucenefiles && \
chmod 775 /opt/bitnami/hapi/data/hapi/lucenefiles

USER root
RUN mkdir -p /target && chown -R 1001:1001 target
USER 1001

Expand All @@ -36,7 +37,7 @@ COPY --from=build-hapi --chown=1001:1001 /tmp/hapi-fhir-jpaserver-starter/opente
ENV ALLOW_EMPTY_PASSWORD=yes

########### distroless brings focus on security and runs on plain spring boot - this is the default image
FROM gcr.io/distroless/java17-debian11:nonroot AS default
FROM gcr.io/distroless/java17-debian12:nonroot AS default
# 65532 is the nonroot user's uid
# used here instead of the name to allow Kubernetes to easily detect that the container
# is running as a non-root (uid != 0) user.
Expand All @@ -46,4 +47,4 @@ WORKDIR /app
COPY --chown=nonroot:nonroot --from=build-distroless /app /app
COPY --chown=nonroot:nonroot --from=build-hapi /tmp/hapi-fhir-jpaserver-starter/opentelemetry-javaagent.jar /app

CMD ["/app/main.war"]
ENTRYPOINT ["java", "--class-path", "/app/main.war", "-Dloader.path=main.war!/WEB-INF/classes/,main.war!/WEB-INF/,/app/extra-classes", "org.springframework.boot.loader.PropertiesLauncher"]
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ services:
build: .
container_name: hapi-fhir-jpaserver-start
restart: on-failure
environment:
SPRING_DATASOURCE_URL: "jdbc:postgresql://hapi-fhir-postgres:5432/hapi"
SPRING_DATASOURCE_USERNAME: "admin"
SPRING_DATASOURCE_PASSWORD: "admin"
SPRING_DATASOURCE_DRIVERCLASSNAME: "org.postgresql.Driver"
ports:
- "8080:8080"
hapi-fhir-postgres:
image: postgres:13-alpine
image: postgres:15-alpine
container_name: hapi-fhir-postgres
restart: always
environment:
Expand Down
Loading

0 comments on commit 7b3fb39

Please sign in to comment.