Skip to content

Commit

Permalink
[FAB-15553] Remove Fabric baseimage
Browse files Browse the repository at this point in the history
Fabric itself no longer has a dependency on the legacy Base Image
and it will eventually be marked for deprecation. This change
removes the SDK's dependency on the Fabric Base Image

Signed-off-by: Brett Logan <[email protected]>
Change-Id: Ie6aeb9b936f84d9e553c57566ef254a6c50cebec
  • Loading branch information
Brett Logan authored and Brett Logan committed May 29, 2019
1 parent 4def0f9 commit 94a6ed7
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 27 deletions.
17 changes: 7 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ DOCKER_COMPOSE_CMD ?= docker-compose
FABRIC_STABLE_VERSION := 1.4.1
FABRIC_STABLE_VERSION_MINOR := 1.4
FABRIC_STABLE_VERSION_MAJOR := 1
FABRIC_BASEIMAGE_STABLE_VERSION := 0.4.15

FABRIC_PRERELEASE_VERSION :=
FABRIC_PRERELEASE_VERSION_MINOR :=
Expand All @@ -53,11 +52,6 @@ GOLANGCI_LINT_VER ?= v1.16.0

# Fabric tool versions (overridable)
FABRIC_TOOLS_VERSION ?= $(FABRIC_STABLE_VERSION)
FABRIC_BASE_VERSION ?= $(FABRIC_BASEIMAGE_STABLE_VERSION)

# Fabric base docker image (overridable)
FABRIC_BASE_IMAGE ?= hyperledger/fabric-baseimage
FABRIC_BASE_TAG ?= $(FABRIC_ARCH)-$(FABRIC_BASE_VERSION)

# Fabric tools docker image (overridable)
FABRIC_TOOLS_IMAGE ?= hyperledger/fabric-tools
Expand All @@ -68,6 +62,10 @@ FABRIC_RELEASE_REGISTRY ?=
FABRIC_DEV_REGISTRY ?= nexus3.hyperledger.org:10001
FABRIC_DEV_REGISTRY_PRE_CMD ?= docker login -u docker -p docker nexus3.hyperledger.org:10001

# Base image variables for socat and softshm builds
BASE_UBUNTU_VERSION = "xenial"
BASE_GO_VERSION = "1.12.5"

# Upstream fabric patching (overridable)
THIRDPARTY_FABRIC_CA_BRANCH ?= master
THIRDPARTY_FABRIC_CA_COMMIT ?= v2.0.0-alpha
Expand Down Expand Up @@ -279,15 +277,14 @@ lint-all: version populate-noforce
.PHONY: build-softhsm2-image
build-softhsm2-image:
@$(DOCKER_CMD) build --no-cache -q -t "fabsdkgo-softhsm2" \
--build-arg FABRIC_BASE_IMAGE=$(FABRIC_BASE_IMAGE) \
--build-arg FABRIC_BASE_TAG=$(FABRIC_BASE_TAG) \
--build-arg BASE_UBUNTU_VERSION=$(BASE_UBUNTU_VERSION) \
--build-arg BASE_GO_VERSION=$(BASE_GO_VERSION) \
-f $(FIXTURE_SOFTHSM2_PATH)/Dockerfile .

.PHONY: build-socat-image
build-socat-image:
@$(DOCKER_CMD) build --no-cache -q -t "fabsdkgo-socat" \
--build-arg FABRIC_BASE_IMAGE=$(FABRIC_BASE_IMAGE) \
--build-arg FABRIC_BASE_TAG=$(FABRIC_BASE_TAG) \
--build-arg BASE_UBUNTU_VERSION=$(BASE_UBUNTU_VERSION) \
-f $(FIXTURE_SOCAT_PATH)/Dockerfile .

.PHONY: unit-test
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/socat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#
# SPDX-License-Identifier: Apache-2.0
#
ARG FABRIC_BASE_IMAGE=hyperledger/fabric-baseimage
ARG FABRIC_BASE_TAG

FROM ${FABRIC_BASE_IMAGE}:${FABRIC_BASE_TAG}
ARG BASE_UBUNTU_VERSION

FROM ubuntu:${BASE_UBUNTU_VERSION}

ENV GOPATH=/opt/gopath \
GOROOT=/opt/go \
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/socat/install-socat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

set -xe

ARCH=`uname -m`
apt-get update

ARCH=`uname -m`
if [ $ARCH = "s390x" ]; then
echo "deb http://ftp.us.debian.org/debian sid main" >> /etc/apt/sources.list
apt-get install -y perl
fi

apt-get update
apt-get install -y --no-install-recommends socat
apt-get install -y --no-install-recommends socat
14 changes: 10 additions & 4 deletions test/fixtures/softhsm2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
#
# SPDX-License-Identifier: Apache-2.0
#
ARG FABRIC_BASE_IMAGE=hyperledger/fabric-baseimage
ARG FABRIC_BASE_TAG

FROM ${FABRIC_BASE_IMAGE}:${FABRIC_BASE_TAG}
ARG BASE_UBUNTU_VERSION

FROM ubuntu:${BASE_UBUNTU_VERSION}

ARG BASE_GO_VERSION

ENV GOPATH=/opt/gopath \
GOROOT=/opt/go \
PATH=$PATH:/opt/go/bin:/opt/gopath/bin
PATH=$PATH:/opt/go/bin:/opt/gopath/bin \
GOVER="${BASE_GO_VERSION}"

COPY test/fixtures/softhsm2/install_go.sh /tmp
RUN /tmp/install_go.sh

COPY test/fixtures/softhsm2/install-softhsm2.sh /tmp
COPY scripts/_go/src/pkcs11helper /opt/workspace/pkcs11helper
Expand Down
9 changes: 3 additions & 6 deletions test/fixtures/softhsm2/install-softhsm2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@

set -xe

ARCH=`uname -m`
apt-get update

ARCH=`uname -m`
if [ $ARCH = "s390x" ]; then
echo "deb http://ftp.us.debian.org/debian sid main" >> /etc/apt/sources.list
apt-get install -y perl
fi

apt-get update
apt-get install -y --no-install-recommends softhsm2 curl git gcc g++ libtool libltdl-dev
mkdir -p /var/lib/softhsm/tokens/
softhsm2-util --init-token --slot 0 --label "ForFabric" --so-pin 1234 --pin 98765432

# Temporary fix for Fabric base image
unset GOCACHE

cd /opt/workspace/pkcs11helper/
go install pkcs11helper/cmd/pkcs11helper
22 changes: 22 additions & 0 deletions test/fixtures/softhsm2/install_go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Copyright IBM Corp, SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

#!/bin/bash

# ----------------------------------------------------------------
# Install Golang
# ----------------------------------------------------------------

apt-get update
apt-get install -y -qq wget
mkdir -p $GOPATH
ARCH=`uname -m | sed 's|i686|386|' | sed 's|x86_64|amd64|'`

cd /tmp
wget --quiet --no-check-certificate https://storage.googleapis.com/golang/go${GOVER}.linux-${ARCH}.tar.gz
tar -xvf go${GOVER}.linux-${ARCH}.tar.gz
mv go $GOROOT
chmod 775 $GOROOT

0 comments on commit 94a6ed7

Please sign in to comment.