Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 3582273

Browse files
committed
Build invocation image locally
Since we are using `docker context` that is not yet released we need to cross-compile the master branch of the cli on Jenkins for our e2e tests to run. This takes a lot of time when not on Linux and it doesn't make sense to do locally. With the new Dockerfile.invocation-image it's possible to run `make invocation-image` and build the invocation image without recompiling the cli. Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
1 parent 941df3f commit 3582273

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

BUILDING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,6 @@ go test -v -run "<TEST_NAME>" .
108108
for docker/cnab-app-base:v0.6.0-68-g3ae57efdb6-dirty not found"`, it means
109109
you forgot to rebuild the base invocation image, simply run
110110

111-
```sh
112-
$ make -f docker.Makefile invocation-image
113-
```
111+
```sh
112+
$ make invocation-image
113+
```

Dockerfile.invocation-image

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ARG ALPINE_VERSION=3.8
2+
ARG GO_VERSION=1.11.0
3+
4+
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build
5+
ARG DOCKERCLI_VERSION=18.03.1-ce
6+
ARG DOCKERCLI_CHANNEL=edge
7+
RUN apk add --no-cache \
8+
make
9+
10+
WORKDIR /go/src/github.com/docker/app/
11+
12+
# builder of invocation image entrypoint
13+
FROM build AS invocation-build
14+
COPY . .
15+
ARG EXPERIMENTAL="off"
16+
RUN make EXPERIMENTAL=${EXPERIMENTAL} bin/cnab-run
17+
18+
# local cnab invocation image
19+
FROM alpine:${ALPINE_VERSION} as invocation
20+
RUN apk add --no-cache ca-certificates
21+
COPY --from=invocation-build /go/src/github.com/docker/app/bin/cnab-run /cnab/app/run
22+
WORKDIR /cnab/app
23+
CMD /cnab/app/run

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ endif
2727
GO_BUILD := CGO_ENABLED=0 go build -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
2828
GO_TEST := CGO_ENABLED=0 go test -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
2929

30+
CNAB_BASE_INVOCATION_IMAGE_NAME := docker/cnab-app-base:$(BUILD_TAG)
31+
3032
all: bin/$(BIN_NAME) test
3133

3234
check_go_env:
@@ -97,6 +99,9 @@ specification/bindata.go: specification/schemas/*.json
9799

98100
schemas: specification/bindata.go ## generate specification/bindata.go from json schemas
99101

102+
invocation-image:
103+
docker build -f Dockerfile.invocation-image $(BUILD_ARGS) --target=invocation -t $(CNAB_BASE_INVOCATION_IMAGE_NAME) .
104+
100105
help: ## this help
101106
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort
102107

0 commit comments

Comments
 (0)