-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile-build
33 lines (25 loc) · 1.22 KB
/
Dockerfile-build
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
# syntax=docker/dockerfile:1.4
FROM azul/zulu-openjdk-alpine:17 AS builder
LABEL maintainer="[email protected]"
RUN apk update && apk add git maven
RUN git clone https://github.com/dlmcpaul/EnphaseCollector.git
WORKDIR EnphaseCollector
RUN mvn package -Dmaven.test.skip
RUN cp target/enphasecollector-development-SNAPSHOT.jar /app.jar
WORKDIR /
# Generate a JDK class data share
# Explode Uber jar into lib jars and classes
RUN "$JAVA_HOME/bin/java" -Xshare:dump && \
"$JAVA_HOME/bin/jar" -xf app.jar
FROM azul/zulu-openjdk-alpine:17-jre-headless
LABEL maintainer="[email protected]"
COPY --from=builder "./BOOT-INF/lib" /app/lib
COPY --from=builder "./META-INF" /app/META-INF
COPY --from=builder "./BOOT-INF/classes" /app
COPY --from=builder "${JAVA_HOME}/lib/server/classes.jsa" "${JAVA_HOME}/lib/server"
ENV SPRING_DATASOURCE_URL=jdbc:h2:/internal_db/solar_stats_db_v2
RUN mkdir "/properties"
RUN touch "/properties/application.properties"
ENTRYPOINT ["java", "-cp", "app:app/lib/*", "-Xshare:auto", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.jmx.enabled=false", "com.hz.EnphaseCollectorApplication", "--spring.config.additional-location=file:/properties/application.properties"]
EXPOSE 8080
VOLUME /internal_db /properties