forked from hashgraph/hedera-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (62 loc) · 2.89 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:20.04 AS base-runtime
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y dos2unix openssl libsodium23 bind9-host
# 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 /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
ENV PATH=/opt/apache-maven-3.8.6/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
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 mkdir /opt/hedera/services/buildSrc
COPY buildSrc /opt/hedera/services/buildSrc
RUN mkdir /opt/hedera/services/gradle
COPY gradle /opt/hedera/services/gradle
COPY gradlew /opt/hedera/services/gradlew
COPY gradle.properties /opt/hedera/services/gradle.properties
COPY settings.gradle.kts /opt/hedera/services/settings.gradle.kts
RUN ./gradlew assemble copyLib copyApp
## 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
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
CMD ["/bin/sh", "-c", "./start-services.sh"]