-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (50 loc) · 1.92 KB
/
Copy pathDockerfile
File metadata and controls
61 lines (50 loc) · 1.92 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
##
# Build Stage
#
FROM maven:3.9.7-eclipse-temurin-21-jammy AS build
##
# Copy Source Code and Build Dependencies
#
ADD ./astm-http-lib/pom.xml /build/astm-http-lib/pom.xml
WORKDIR /build/astm-http-lib
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
mvn dependency:go-offline
ADD ./astm-http-lib/src /build/astm-http-lib/src
##
# Build Project
#
WORKDIR /build
ADD ./pom.xml /build/pom.xml
ADD ./contracts /build/contracts
ADD ./src /build/src
# Build library and main project in a single RUN to share .m2 repository
# This ensures the locally installed library is available for the main project build
RUN --mount=type=cache,target=/root/.m2,sharing=locked \
cd /build/astm-http-lib && mvn clean install -DskipTests && \
cd /build && mvn clean package -DskipTests
##
# Run Stage
#
FROM eclipse-temurin:21-jre-alpine
RUN apk add --no-cache curl gcompat
RUN addgroup -S astm --gid 9257 && adduser -S astm -s /bin/bash -u 9257 -G astm
RUN mkdir /app
RUN chown astm:astm /app
RUN mkdir -p /data/openelis-analyzer-bridge && chown -R astm:astm /data
VOLUME /data/openelis-analyzer-bridge
# The outbox and FILE state default to the JVM temporary directory, which does not survive the
# container being recreated. The outbox is the only copy of a result OpenELIS has not accepted.
ENV BRIDGE_OUTBOX_DB_PATH=/data/openelis-analyzer-bridge/outbox.db \
BRIDGE_FILE_STATE_STORE_PATH=/data/openelis-analyzer-bridge/state.db
#Deploy the jar into java image
COPY --from=build /build/target/*.jar /app/openelis-analyzer-bridge.jar
ADD healthcheck.sh /app/healthcheck.sh
ADD docker-entrypoint.sh /app/docker-entrypoint.sh
RUN chown astm:astm /app/docker-entrypoint.sh; \
chmod 770 /app/docker-entrypoint.sh; \
chown astm:astm /app/openelis-analyzer-bridge.jar; \
chmod 770 /app/openelis-analyzer-bridge.jar; \
chown astm:astm /app/healthcheck.sh; \
chmod 770 /app/healthcheck.sh;
USER astm:astm
ENTRYPOINT [ "/app/docker-entrypoint.sh" ]