Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/45'
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelkarp committed Apr 27, 2021
2 parents 95e08c0 + e8979d1 commit 7e60386
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,35 @@ UPDATER_TARGET_ARCH = amd64

# the docker image that will be used to compile go code
BUILDER_IMAGE = public.ecr.aws/bottlerocket/bottlerocket-sdk-${BOTTLEROCKET_SDK_ARCH}:${BOTTLEROCKET_SDK_VERSION}
SOURCEDIR=./updater
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
export GO111MODULE=on

.PHONY: fetch-dependency # downloads go.mod dependency
fetch-dependency:
cd updater && GO111MODULE=on go mod tidy
all: build

.PHONY: tidy
tidy:
cd updater && go mod tidy

.PHONY: build # builds updater
build: fetch-dependency
build: updater/bin/bottlerocket-ecs-updater
updater/bin/bottlerocket-ecs-updater: $(SOURCES) updater/go.mod updater/go.sum
GOARCH=$(UPDATER_TARGET_ARCH)
cd updater && GO111MODULE=on go build -v -o bin/bottlerocket-ecs-updater .
cd updater && go build -v -o bin/bottlerocket-ecs-updater .

.PHONY: test
test:
cd updater && go test -v ./...


.PHONY: image # creates a docker image with the updater binary
image: build
image:
DOCKER_BUILDKIT=1 \
docker build \
-t bottlerocket-ecs-updater:latest \
--build-arg BUILDER_IMAGE=${BUILDER_IMAGE} \
--build-arg GOARCH=${UPDATER_TARGET_ARCH} \
"${PWD}/updater"

clean:
-rm -rf updater/bin

0 comments on commit 7e60386

Please sign in to comment.