-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile-for-agent
58 lines (43 loc) · 1.77 KB
/
Dockerfile-for-agent
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
# Copyright 2019-2023 Hitachi, Ltd., Hitachi America, Ltd. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
ARG NODE_VERSION
FROM node:${NODE_VERSION} AS build
ARG FABRIC_VERSION
COPY opssc-agent/src /opt/app/src
COPY common /opt/common
# Allow npm to run prepare script as root
RUN cd /opt/common/src; npm --unsafe-perm install
RUN cd /opt/app/src; npm --unsafe-perm install
# Download fabric binaries
RUN mkdir /opt/fabric
RUN cd /opt/fabric; \
curl -LO https://github.com/hyperledger/fabric/releases/download/v${FABRIC_VERSION}/hyperledger-fabric-linux-amd64-${FABRIC_VERSION}.tar.gz; \
tar -xzf hyperledger-fabric-linux-amd64-${FABRIC_VERSION}.tar.gz
# Add helm
ENV HELM_VERSION=v3.10.0
RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
RUN chmod 700 get_helm.sh
RUN ./get_helm.sh --version $HELM_VERSION
RUN rm get_helm.sh
# Add kubectl
RUN curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
RUN install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
FROM node:${NODE_VERSION}-slim
RUN apt-get update && apt-get -y install git
RUN mkdir /config
COPY --from=build /opt/fabric/config /config
COPY --from=build /opt/fabric/bin/peer /usr/local/bin
COPY --from=build /usr/local/bin/helm /usr/local/bin
COPY --from=build /usr/local/bin/kubectl /usr/local/bin
COPY --from=build /opt/common/src /opt/common/src
COPY --from=build /opt/app/src /opt/app/src
# Add fabric-configtx-cli
COPY configtx-cli/bin/fabric-configtx-cli /usr/local/bin
# Add chart for chaincode server
COPY opssc-agent/charts/chaincode-server /opt/chart
# Add chaincode for opssc
COPY chaincode /opt/go/src/bootstrap/
# Set default GOPATH
ENV GOPATH=/opt/go
ENTRYPOINT cd /opt/app/src; npm start