2025-01-07 15:56:32 +01:00
|
|
|
FROM eclipse-temurin:21-jdk-alpine as BUILD
|
2017-12-06 01:29:47 +09:00
|
|
|
|
|
|
|
# Let's fetch eclair dependencies, so that Docker can cache them
|
|
|
|
# This way we won't have to fetch dependencies again if only the source code changes
|
|
|
|
# The easiest way to reliably get dependencies is to build the project with no sources
|
|
|
|
WORKDIR /usr/src
|
2025-01-07 15:56:32 +01:00
|
|
|
COPY mvnw mvnw
|
|
|
|
COPY .mvn .mvn
|
2017-12-06 01:29:47 +09:00
|
|
|
COPY pom.xml pom.xml
|
|
|
|
COPY eclair-core/pom.xml eclair-core/pom.xml
|
2020-12-14 17:24:34 +01:00
|
|
|
COPY eclair-front/pom.xml eclair-front/pom.xml
|
2017-12-06 01:29:47 +09:00
|
|
|
COPY eclair-node/pom.xml eclair-node/pom.xml
|
2020-03-02 10:25:17 +01:00
|
|
|
COPY eclair-node/modules/assembly.xml eclair-node/modules/assembly.xml
|
2017-12-06 01:29:47 +09:00
|
|
|
RUN mkdir -p eclair-core/src/main/scala && touch eclair-core/src/main/scala/empty.scala
|
|
|
|
# Blank build. We only care about eclair-node, and we use install because eclair-node depends on eclair-core
|
2025-01-07 15:56:32 +01:00
|
|
|
RUN ./mvnw install -pl eclair-node -am
|
|
|
|
RUN ./mvnw clean
|
2017-12-06 01:29:47 +09:00
|
|
|
|
|
|
|
# Only then do we copy the sources
|
|
|
|
COPY . .
|
|
|
|
|
2017-12-06 16:10:22 +01:00
|
|
|
# And this time we can build in offline mode, specifying 'notag' instead of git commit
|
2025-01-07 15:56:32 +01:00
|
|
|
RUN ./mvnw package -pl eclair-node -am -DskipTests -Dgit.commit.id=notag -Dgit.commit.id.abbrev=notag -o
|
2017-12-06 01:29:47 +09:00
|
|
|
# It might be good idea to run the tests here, so that the docker build fail if the code is bugged
|
|
|
|
|
2025-01-07 15:56:32 +01:00
|
|
|
FROM eclipse-temurin:21-jre-alpine
|
2017-12-06 01:29:47 +09:00
|
|
|
WORKDIR /app
|
2019-07-05 09:10:06 +02:00
|
|
|
|
|
|
|
# install jq for eclair-cli
|
2025-01-07 15:56:32 +01:00
|
|
|
RUN apk add bash jq curl unzip
|
2019-07-05 09:10:06 +02:00
|
|
|
|
|
|
|
# copy and install eclair-cli executable
|
|
|
|
COPY --from=BUILD /usr/src/eclair-core/eclair-cli .
|
|
|
|
RUN chmod +x eclair-cli && mv eclair-cli /sbin/eclair-cli
|
|
|
|
|
2020-02-24 15:42:26 +01:00
|
|
|
# we only need the eclair-node.zip to run
|
|
|
|
COPY --from=BUILD /usr/src/eclair-node/target/eclair-node-*.zip ./eclair-node.zip
|
2020-10-13 11:44:34 +02:00
|
|
|
RUN unzip eclair-node.zip && mv eclair-node-* eclair-node && chmod +x eclair-node/bin/eclair-node.sh
|
2017-12-08 23:36:50 +09:00
|
|
|
|
|
|
|
ENV ECLAIR_DATADIR=/data
|
|
|
|
ENV JAVA_OPTS=
|
|
|
|
|
|
|
|
RUN mkdir -p "$ECLAIR_DATADIR"
|
|
|
|
VOLUME [ "/data" ]
|
|
|
|
|
2020-10-13 11:44:34 +02:00
|
|
|
ENTRYPOINT JAVA_OPTS="${JAVA_OPTS}" eclair-node/bin/eclair-node.sh "-Declair.datadir=${ECLAIR_DATADIR}"
|