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>
This commit is contained in:
Djordje Lukic 2019-02-06 17:39:29 +01:00
Родитель 941df3fa74
Коммит 35822738a9
3 изменённых файлов: 31 добавлений и 3 удалений

Просмотреть файл

@ -108,6 +108,6 @@ go test -v -run "<TEST_NAME>" .
for docker/cnab-app-base:v0.6.0-68-g3ae57efdb6-dirty not found"`, it means
you forgot to rebuild the base invocation image, simply run
```sh
$ make -f docker.Makefile invocation-image
```
```sh
$ make invocation-image
```

Просмотреть файл

@ -0,0 +1,23 @@
ARG ALPINE_VERSION=3.8
ARG GO_VERSION=1.11.0
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build
ARG DOCKERCLI_VERSION=18.03.1-ce
ARG DOCKERCLI_CHANNEL=edge
RUN apk add --no-cache \
make
WORKDIR /go/src/github.com/docker/app/
# builder of invocation image entrypoint
FROM build AS invocation-build
COPY . .
ARG EXPERIMENTAL="off"
RUN make EXPERIMENTAL=${EXPERIMENTAL} bin/cnab-run
# local cnab invocation image
FROM alpine:${ALPINE_VERSION} as invocation
RUN apk add --no-cache ca-certificates
COPY --from=invocation-build /go/src/github.com/docker/app/bin/cnab-run /cnab/app/run
WORKDIR /cnab/app
CMD /cnab/app/run

Просмотреть файл

@ -27,6 +27,8 @@ endif
GO_BUILD := CGO_ENABLED=0 go build -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
GO_TEST := CGO_ENABLED=0 go test -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
CNAB_BASE_INVOCATION_IMAGE_NAME := docker/cnab-app-base:$(BUILD_TAG)
all: bin/$(BIN_NAME) test
check_go_env:
@ -97,6 +99,9 @@ specification/bindata.go: specification/schemas/*.json
schemas: specification/bindata.go ## generate specification/bindata.go from json schemas
invocation-image:
docker build -f Dockerfile.invocation-image $(BUILD_ARGS) --target=invocation -t $(CNAB_BASE_INVOCATION_IMAGE_NAME) .
help: ## this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort