From 897a280a9f1f949dfda66ccf808a6fbfff4a24f2 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Sat, 9 May 2020 15:50:20 +0800 Subject: [PATCH] Add Dockerfile --- Dockerfile | 9 +++++++++ Makefile | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..49ff12af4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM docker.io/openshift/origin-release:golang-1.13 AS builder +WORKDIR /go/src/github.com/open-cluster-management/work +COPY . . +ENV GO_PACKAGE github.com/open-cluster-management/nucleus +RUN make build --warn-undefined-variables + +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1-398 + +COPY --from=builder /go/src/github.com/open-cluster-management/nucleus/nucleus / diff --git a/Makefile b/Makefile index 2cc7ac031..7f3a2be30 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ all: build .PHONY: all +IMAGE_REGISTRY?=quay.io + # Include the library makefile include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \ golang.mk \ @@ -18,6 +20,14 @@ copy-crd: update-all: copy-crd update +# This will call a macro called "build-image" which will generate image specific targets based on the parameters: +# $0 - macro name +# $1 - target suffix +# $2 - Dockerfile path +# $3 - context directory for image build +# It will generate target "image-$(1)" for builing the image an binding it as a prerequisite to target "images". +$(call build-image,nucleus,$(IMAGE_REGISTRY)/open-cluster-management/nucleus,./Dockerfile,.) + clean: $(RM) ./nucleus .PHONY: clean