github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/sawtooth-core-master/sdk/examples/xo_go/Dockerfile-installed (about)

     1  # Copyright 2018 Cargill Incorporated
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  # docker build -f sdk/examples/xo_go/Dockerfile-installed -t sawtooth-xo-tp-go .
    16  
    17  # -------------=== xo-tp-go build ===-------------
    18  
    19  FROM ubuntu:xenial as xo-tp-go-builder
    20  
    21  ENV VERSION=AUTO_STRICT
    22  
    23  RUN echo "deb [arch=amd64] http://repo.sawtooth.me/ubuntu/ci xenial universe" >> /etc/apt/sources.list \
    24   && echo "deb http://archive.ubuntu.com/ubuntu xenial-backports universe" >> /etc/apt/sources.list \
    25   && (apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD \
    26   || apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 8AA7AF1F1091A5FD) \
    27   && apt-get update \
    28   && apt-get install -y -q --allow-downgrades \
    29      build-essential \
    30      golang-1.9-go \
    31      git \
    32      libssl-dev \
    33      libzmq3-dev \
    34      openssl \
    35      python3-grpcio-tools=1.1.3-1 \
    36   && apt-get clean \
    37   && rm -rf /var/lib/apt/lists/*
    38  
    39  ENV GOPATH=/go:/project/sdk/go:/project/sdk/examples/xo_go
    40  
    41  ENV PATH=$PATH:/project/bin:/go/bin:/usr/lib/go-1.9/bin
    42  
    43  RUN mkdir /go
    44  
    45  RUN go get -u \
    46      github.com/golang/protobuf/proto \
    47      github.com/golang/protobuf/protoc-gen-go \
    48      github.com/pebbe/zmq4 \
    49      github.com/brianolson/cbor_go \
    50      github.com/satori/go.uuid \
    51      github.com/btcsuite/btcd/btcec \
    52      github.com/jessevdk/go-flags \
    53      github.com/pelletier/go-toml \
    54      github.com/golang/mock/gomock \
    55      github.com/golang/mock/mockgen \
    56      golang.org/x/crypto/ripemd160 \
    57      golang.org/x/crypto/ssh
    58  
    59  COPY . /project
    60  
    61  WORKDIR /project
    62  
    63  RUN bin/protogen go \
    64   && cd sdk/examples/xo_go \
    65   && if [ -d "bin" ]; then rm -rf bin; fi \
    66   && mkdir bin \
    67   && cd src/sawtooth_xo \
    68   && go build -o /project/sdk/examples/xo_go/bin/xo-tp-go
    69  
    70  RUN pkg=xo_go \
    71   && GO_TP_DASH=$(echo $pkg | sed s/_/-/) \
    72   && CHANGELOG_DIR="debian/usr/share/doc/sawtooth-tp-$GO_TP_DASH" \
    73   && ST_VERSION=$(bin/get_version) \
    74   && cd sdk/examples/$pkg \
    75   && if [ -d "debian" ]; then rm -rf debian; fi \
    76   && mkdir -p debian/DEBIAN \
    77   && mkdir -p $CHANGELOG_DIR \
    78   && cp packaging/ubuntu/* debian \
    79   && sed -i -e"s/@VERSION@/$ST_VERSION/" debian/control \
    80   && sed -i -e"s/@VERSION@/$ST_VERSION/" debian/changelog \
    81   && cp debian/changelog $CHANGELOG_DIR \
    82   && mv debian/changelog $CHANGELOG_DIR/changelog.Debian \
    83   && gzip --best $CHANGELOG_DIR/changelog \
    84   && gzip --best $CHANGELOG_DIR/changelog.Debian \
    85   && mv debian/control debian/DEBIAN \
    86   && mv debian/postinst debian/DEBIAN \
    87   && PACKAGENAME=$(awk '/^Package:/ { print $2 }' debian/DEBIAN/control) \
    88   && PACKAGEVERSION=$(dpkg-parsechangelog -S version -l $CHANGELOG_DIR/changelog.gz) \
    89   && PACKAGEARCH=$(dpkg-architecture -qDEB_BUILD_ARCH) \
    90   && mkdir debian/usr/bin \
    91   && cp -R bin/ debian/usr/ \
    92   && cp -R packaging/systemd/* debian/ \
    93   && fakeroot dpkg-deb --build debian \
    94   && echo -- \
    95   && echo "${PACKAGENAME}_${PACKAGEVERSION}_${PACKAGEARCH}.deb" \
    96   && echo -- \
    97   && mv debian.deb "${PACKAGENAME}_${PACKAGEVERSION}_${PACKAGEARCH}.deb"
    98  
    99  # -------------=== sawtooth-xo-tp-go build ===-------------
   100  
   101  FROM ubuntu:xenial
   102  
   103  COPY --from=xo-tp-go-builder /project/sdk/examples/xo_go/sawtooth-xo-tp-go_*.deb /tmp
   104  
   105  RUN apt-get update \
   106   && dpkg -i /tmp/sawtooth-*.deb || true \
   107   && apt-get -f -y install
   108  
   109  CMD ["xo-tp-go", "-vv"]