|
| 1 | +FROM maven:3.9.7-eclipse-temurin-17-alpine AS builder |
| 2 | +WORKDIR /code |
1 | 3 |
|
| 4 | +ARG MAVEN_PROFILE=webapi-docker |
| 5 | +ARG MAVEN_PARAMS="-DskipUnitTests -DskipITtests -D\"maven.test.skip\"=true" # can use maven options, e.g. -DskipTests=true -DskipUnitTests=true |
| 6 | + |
| 7 | +# Install curl |
| 8 | +RUN apk add --no-cache curl |
| 9 | + |
| 10 | +ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.17.0 |
| 11 | +RUN curl -LSsO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OPENTELEMETRY_JAVA_AGENT_VERSION}/opentelemetry-javaagent.jar |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +# OHDSI WebAPI and ATLAS web application running as a Spring Boot application with Java 11 |
| 16 | +# FROM openjdk:17-jdk-slim |
| 17 | +# FROM eclipse-temurin:17-jre-alpine |
| 18 | +ARG BASE_REGISTRY=201959883603.dkr.ecr.us-east-2.amazonaws.com |
| 19 | +ARG BASE_IMAGE_PATH=mdaca/base-images/ironbank-alpine-java |
| 20 | +ARG BASE_TAG=3.20.2_jdk17 |
| 21 | +ARG BASE_IMAGE=${BASE_REGISTRY}/${BASE_IMAGE_PATH}:${BASE_TAG} |
| 22 | +ARG $BASE_IMAGE |
| 23 | +FROM $BASE_IMAGE |
| 24 | + |
| 25 | +# Any Java options to pass along, e.g. memory, garbage collection, etc. |
| 26 | +ENV JAVA_OPTS="" |
| 27 | +# Additional classpath parameters to pass along. If provided, start with colon ":" |
| 28 | +ENV CLASSPATH="" |
| 29 | +# Default Java options. The first entry is a fix for when java reads secure random numbers: |
| 30 | +# in a containerized system using /dev/random may reduce entropy too much, causing slowdowns. |
| 31 | +# https://ruleoftech.com/2016/avoiding-jvm-delays-caused-by-random-number-generation |
| 32 | +ENV DEFAULT_JAVA_OPTS="-Djava.security.egd=file:///dev/./urandom" |
| 33 | + |
| 34 | +# set working directory to a fixed WebAPI directory |
| 35 | +WORKDIR /var/lib/ohdsi/webapi |
| 36 | + |
| 37 | +COPY --from=builder /code/opentelemetry-javaagent.jar . |
| 38 | + |
| 39 | +# deploy the just built OHDSI WebAPI war file |
| 40 | +# copy resources in order of fewest changes to most changes. |
| 41 | +# This way, the libraries step is not duplicated if the dependencies |
| 42 | +# do not change. |
| 43 | +COPY --from=builder /code/war/WEB-INF/lib*/* WEB-INF/lib/ |
| 44 | +COPY --from=builder /code/war/org org |
| 45 | +COPY --from=builder /code/war/WEB-INF/classes WEB-INF/classes |
| 46 | +COPY --from=builder /code/war/META-INF META-INF |
| 47 | + |
| 48 | +ENV WEBAPI_DATASOURCE_URL="jdbc:postgresql://host.docker.internal:5432/OHDSI?currentSchema=webapi" |
| 49 | +# ENV WEBAPI_DATASOURCE_URL="jdbc:postgresql://10.0.21.93:32000/OHDSI?currentSchema=webapi" |
| 50 | +ENV WEBAPI_DATASOURCE_USERNAME=ohdsi_app_user |
| 51 | +ENV WEBAPI_DATASOURCE_PASSWORD=app1 |
| 52 | +ENV WEBAPI_SCHEMA=webapi |
| 53 | +ENV FLYWAY_DATASOURCE_USERNAME=ohdsi_admin_user |
| 54 | +ENV FLYWAY_DATASOURCE_PASSWORD=admin1 |
| 55 | + |
| 56 | +EXPOSE 8080 |
| 57 | + |
| 58 | +USER 101 |
| 59 | + |
| 60 | +# Directly run the code as a WAR. |
| 61 | +CMD exec java ${DEFAULT_JAVA_OPTS} ${JAVA_OPTS} \ |
| 62 | + -cp ".:WebAPI.jar:WEB-INF/lib/*.jar${CLASSPATH}" \ |
| 63 | + org.springframework.boot.loader.launch.WarLauncher |
0 commit comments