forked from hashgraph/hedera-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (62 loc) · 3.13 KB
/
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
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
62
63
64
65
66
67
68
## Installs OpenJDK17 and openssl (used by Swirlds Platform to
## generate node keys for e.g. signing states), then copies
## required libraries and startup assets for a node with:
## * Configuration from /opt/hedera/services/config-mount; and,
## * Logs at /opt/hedera/services/output; and,
## * Saved states under /opt/hedera/services/output
FROM ubuntu:21.10 AS base-runtime
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y dos2unix openssl libsodium23 postgresql-client
# JDK
RUN apt-get install -y software-properties-common && \
add-apt-repository -y ppa:openjdk-r/ppa && \
apt-get install -y openjdk-17-jdk
# Services runtime
RUN mkdir -p /opt/hedera/services/data/lib
RUN mkdir -p /opt/hedera/services/data/backup
RUN mkdir /opt/hedera/services/data/apps
RUN mkdir /opt/hedera/services/data/config
RUN mkdir /opt/hedera/services/data/saved
RUN mkdir /opt/hedera/services/data/onboard
RUN mkdir /opt/hedera/services/output
RUN mkdir /opt/hedera/services/config-mount
## Builds the HederaNode.jar from the current source tree and creates
## the /opt/hedera/services/.VERSION file
FROM base-runtime AS services-builder
# Maven
# Note: Java 17 requires Maven 3.8+ so the distro provided one just won't do
RUN apt-get update && \
apt-get install -y wget unzip && \
wget https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.zip && \
unzip apache-maven-3.8.4-bin.zip -d /opt && \
rm apache-maven-3.8.4-bin.zip
ENV PATH=/opt/apache-maven-3.8.4/bin:$PATH
WORKDIR /opt/hedera/services
# Install Services
COPY .env /opt/hedera/services
RUN for PIECE in $(cat .env | head -1 | tr '=' ' '); do \
if [ "$IS_VERSION" = "true" ]; then echo $PIECE >> .VERSION ; else IS_VERSION=true; fi done
COPY pom.xml /opt/hedera/services
RUN mkdir /opt/hedera/services/hapi-utils
COPY hapi-utils /opt/hedera/services/hapi-utils
RUN mkdir /opt/hedera/services/hapi-fees
COPY hapi-fees /opt/hedera/services/hapi-fees
RUN mkdir /opt/hedera/services/hedera-node
COPY hedera-node /opt/hedera/services/hedera-node
RUN mkdir /opt/hedera/services/test-clients
COPY test-clients /opt/hedera/services/test-clients
RUN mvn install -pl hedera-node -am -DskipTests -Dmaven.gitcommitid.skip=true
## Finishes by copying the Services JAR to the base runtime
FROM base-runtime AS final-image
COPY image-utils/ /opt/hedera/services
COPY --from=services-builder /opt/hedera/services/.VERSION /opt/hedera/services
COPY --from=services-builder /opt/hedera/services/hedera-node/data/lib /opt/hedera/services/data/lib
COPY --from=services-builder /opt/hedera/services/hedera-node/data/backup /opt/hedera/services/data/backup
COPY --from=services-builder /opt/hedera/services/hedera-node/swirlds.jar /opt/hedera/services/data/lib
RUN ls -al /opt/hedera/services/data/lib
COPY --from=services-builder /opt/hedera/services/hedera-node/data/onboard/StartUpAccount.txt /opt/hedera/services/data/onboard
COPY --from=services-builder /opt/hedera/services/hedera-node/data/apps /opt/hedera/services/data/apps
WORKDIR /opt/hedera/services
RUN dos2unix start-services.sh wait-for-it /opt/hedera/services/data/backup/*.sh
CMD ["/bin/sh", "-c", "./start-services.sh"]