From f1df324edd5b8d36f63843bfcc5b86bd1f5b046f Mon Sep 17 00:00:00 2001 From: asararatnakar Date: Sun, 9 Oct 2022 22:26:02 -0400 Subject: [PATCH] Pushing init image for k8s builder to work Signed-off-by: asararatnakar --- .github/workflows/init-image-build-n-push.yaml | 16 ++++++++++++++++ Makefile | 6 ++++++ sample-network/init/Dockerfile | 17 +++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 .github/workflows/init-image-build-n-push.yaml create mode 100644 sample-network/init/Dockerfile diff --git a/.github/workflows/init-image-build-n-push.yaml b/.github/workflows/init-image-build-n-push.yaml new file mode 100644 index 00000000..567151bc --- /dev/null +++ b/.github/workflows/init-image-build-n-push.yaml @@ -0,0 +1,16 @@ +name: Build Init image + +on: + push: + branches: [main] + +jobs: + image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Build and Push Init Image + run: | + echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin + make init-image diff --git a/Makefile b/Makefile index b3f8e106..66adf94c 100644 --- a/Makefile +++ b/Makefile @@ -17,11 +17,13 @@ # IMAGE ?= ghcr.io/hyperledger-labs/fabric-operator +INIT_IMAGE ?= ghcr.io/hyperledger-labs/init TAG ?= $(shell git rev-parse --short HEAD) ARCH ?= $(shell go env GOARCH) OSS_GO_VER ?= 1.17.7 BUILD_DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") OS = $(shell go env GOOS) +K8S_TAG = v0.6.0 DOCKER_IMAGE_REPO ?= ghcr.io @@ -47,6 +49,10 @@ image: setup docker build --rm . -f Dockerfile $(BUILD_ARGS) -t $(IMAGE):$(TAG)-$(ARCH) docker tag $(IMAGE):$(TAG)-$(ARCH) $(IMAGE):latest-$(ARCH) +init-image: + docker build --rm . -f sample-network/init/Dockerfile --build-arg K8S_TAG=$(K8S_TAG) -t $(INIT_IMAGE):latest-$(ARCH) + docker push $(INIT_IMAGE):latest-$(ARCH) + govendor: @go mod vendor diff --git a/sample-network/init/Dockerfile b/sample-network/init/Dockerfile new file mode 100644 index 00000000..30de27e9 --- /dev/null +++ b/sample-network/init/Dockerfile @@ -0,0 +1,17 @@ +ARG K8S_TAG +FROM ghcr.io/hyperledgendary/k8s-fabric-peer:${K8S_TAG} as builder + +FROM registry.access.redhat.com/ubi8/ubi-minimal + +RUN microdnf update \ + && microdnf install -y \ + shadow-utils \ + iputils \ + tar \ + && groupadd -g 7051 ibp-user \ + && useradd -u 7051 -g ibp-user -s /bin/bash ibp-user \ + && microdnf remove shadow-utils \ + && microdnf clean all \ + && mkdir -p /opt/hyperledger/k8s_builder/bin; + +COPY --from=builder /opt/hyperledger/k8s_builder/bin/ /opt/hyperledger/k8s_builder/bin/ \ No newline at end of file