Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

[WIP] Add CNAB support #426

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
_build/
bin/
!examples/simple/*.dockerapp
!e2e/**/*.dockerapp
!**/testdata/**/*.dockerapp
.gradle
coverage.html
cover.out
**/bundle.json
18 changes: 4 additions & 14 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ end you need to have `GOPATH` set in your environment.

At this point you can use `go` to checkout `docker-app` in your `GOPATH`:

```console
```sh
go get github.com/docker/app
```

Expand All @@ -39,14 +39,14 @@ You are ready to build `docker-app` yourself!
`docker-app` uses `make` to create a repeatable build flow. It means that you
can run:

```console
```sh
make
```

This is going to build all the project binaries in the `./bin/`
directory, run tests (unit and end-to-end).

```console
```sh
make bin/docker-app # builds the docker-app binary
make bin/docker-app-darwin # builds the docker-app binary for darwin
make bin/docker-app-windows.exe # builds the docker-app binary for windows
Expand All @@ -59,16 +59,6 @@ make test-e2e # run the end-to-end tests
Vendoring of external imports uses the [`dep`](https://github.com/golang/dep) tool.
Please refer to its documentation if you need to update a dependency.

### Experimental

Just add the `EXPERIMENTAL=on` flag before invoking a build target:
```console
$ make EXPERIMEMTAL=on bin/docker-app
$ ./bin/docker-app version
...
Experimental: on
```

## Build using Docker

If you don't have Go installed but Docker is present, you can also use
Expand Down Expand Up @@ -99,7 +89,7 @@ capabilities without using the `Makefile` targets. The following
examples show how to specify a test name and also how to use the flag
directly against `go test` to run root-requiring tests.

```console
```sh
# run the test <TEST_NAME>:
go test -v -run "<TEST_NAME>" .
```
33 changes: 30 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ RUN apk add --no-cache \
git \
curl \
util-linux \
coreutils
coreutils \
build-base
RUN curl -Ls https://download.docker.com/linux/static/$DOCKERCLI_CHANNEL/x86_64/docker-$DOCKERCLI_VERSION.tgz | \
tar -xz docker/docker && \
mv docker/docker /usr/bin/docker

WORKDIR /go/src/github.com/docker/app/

# main dev image
FROM build AS dev
ENV PATH=${PATH}:/go/src/github.com/docker/app/bin/
ARG DEP_VERSION=v0.5.0
Expand All @@ -26,14 +28,39 @@ RUN go get -d gopkg.in/mjibson/esc.v0 && \
cd /go/src/github.com/mjibson/esc && \
go build -v -o /usr/bin/esc . && \
rm -rf /go/src/* /go/pkg/* /go/bin/*
COPY vendor/github.com/deis/duffle /go/src/github.com/deis/duffle
# Build duffle and init
RUN (cd /go/src/github.com/deis/duffle && \
make bootstrap build-release && \
./bin/duffle-linux-amd64 init)
COPY . .

# FIXME(vdemeester) change from docker-app to dev once buildkit is merged in moby/docker
FROM dev AS cross
ARG EXPERIMENTAL="off"
RUN make EXPERIMENTAL=${EXPERIMENTAL} cross
ARG TAG
ARG COMMIT
RUN make EXPERIMENTAL=${EXPERIMENTAL} TAG=${TAG} COMMIT=${COMMIT} cross

# FIXME(vdemeester) change from docker-app to dev once buildkit is merged in moby/docker
FROM cross AS e2e-cross
ARG EXPERIMENTAL="off"
RUN make EXPERIMENTAL=${EXPERIMENTAL} e2e-cross
# Run e2e tests
ARG TAG
ARG COMMIT
RUN make EXPERIMENTAL=${EXPERIMENTAL} TAG=${TAG} COMMIT=${COMMIT} e2e-cross

# builder of invocation image entrypoint
FROM build AS invocation-build
COPY . .
ARG EXPERIMENTAL="off"
ARG TAG
ARG COMMIT
RUN make EXPERIMENTAL=${EXPERIMENTAL} TAG=${TAG} COMMIT=${COMMIT} bin/run

# 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/run /cnab/app/run
WORKDIR /cnab/app
CMD /cnab/app/run
Loading