Skip to content

Commit

Permalink
adding BUILD_ARG
Browse files Browse the repository at this point in the history
  • Loading branch information
tibers committed Oct 7, 2019
1 parent 1c9d566 commit 1414a4d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@

# Bump these on release
VERSION_MAJOR ?= 0
VERSION_MINOR ?= 13
VERSION_MINOR ?= 12
VERSION_BUILD ?= 0

VERSION ?= v$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD)
VERSION_PACKAGE = $(REPOPATH/pkg/version)

SHELL := /bin/bash
GOOS ?= $(shell go env GOOS)
Expand All @@ -27,7 +28,6 @@ PROJECT := kaniko
REGISTRY?=gcr.io/kaniko-project

REPOPATH ?= $(ORG)/$(PROJECT)
VERSION_PACKAGE = $(REPOPATH)/pkg/version

GO_FILES := $(shell find . -type f -name '*.go' -not -path "./vendor/*")
GO_LDFLAGS := '-extldflags "-static"
Expand All @@ -38,6 +38,7 @@ GO_LDFLAGS += '
EXECUTOR_PACKAGE = $(REPOPATH)/cmd/executor
WARMER_PACKAGE = $(REPOPATH)/cmd/warmer
KANIKO_PROJECT = $(REPOPATH)/kaniko
BUILD_ARG ?= ''

This comment has been minimized.

Copy link
@slmagus

slmagus Oct 16, 2019

@tibers BUILD_ARGS ?= '' results in an error when attempting to run make images.

~/kaniko$ make images
docker build '' -t gcr.io/kaniko-project/executor:latest -f deploy/Dockerfile .
"docker build" requires exactly 1 argument.
See 'docker build --help'.

Usage: docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile
Makefile:59: recipe for target 'images' failed
make: *** [images] Error 1

I changed it to BUILD_ARG ?= and it got past the error

This comment has been minimized.

Copy link
@tibers

tibers Oct 16, 2019

Author Contributor

Ah ha! Thank you!


out/executor: $(GO_FILES)
GOARCH=$(GOARCH) GOOS=linux CGO_ENABLED=0 go build -ldflags $(GO_LDFLAGS) -o $@ $(EXECUTOR_PACKAGE)
Expand All @@ -55,6 +56,7 @@ integration-test:

.PHONY: images
images:
docker build -t $(REGISTRY)/executor:latest -f deploy/Dockerfile .
docker build -t $(REGISTRY)/executor:debug -f deploy/Dockerfile_debug .
docker build -t $(REGISTRY)/warmer:latest -f deploy/Dockerfile_warmer .
docker build ${BUILD_ARG} -t $(REGISTRY)/executor:latest -f deploy/Dockerfile .
docker build ${BUILD_ARG} -t $(REGISTRY)/executor:debug -f deploy/Dockerfile_debug .
docker build ${BUILD_ARG} -t $(REGISTRY)/warmer:latest -f deploy/Dockerfile_warmer .

0 comments on commit 1414a4d

Please sign in to comment.