-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
31 lines (22 loc) · 995 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
ARG maven_image=maven
ARG maven_image_tag=3.6.2-jdk-11
ARG openjdk_image=usgswma/openjdk
ARG openjdk_image_tag=11.0.4-jre-baa3726df925e679dedf110bc1dca29b323e5324
FROM ${maven_image}:${maven_image_tag} AS build
LABEL maintainer="[email protected]"
# Add pom.xml and install dependencies
COPY pom.xml /build/pom.xml
WORKDIR /build
RUN mvn -B dependency:go-offline
# Add source code and (by default) build the jar
COPY src /build/src
RUN mvn -B clean package -Dmaven.test.skip=true
FROM ${openjdk_image}:${openjdk_image_tag}
RUN apt-get update && apt-get install --no-install-recommends --no-upgrade -y \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY --chown=1000:1000 --from=build /build/target/pubs-services*.jar app.jar
USER $USER
CMD ["java", "-jar", "app.jar"]
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -H "Accept: application/json" -v -k "http://127.0.0.1:${SERVER_PORT}${SERVER_CONTEXT_PATH}/about/health" | grep -q "{\"status\":\"UP\"}" || exit 1