mirror of https://github.com/docker/cli.git
add Makefiles and document their use in the README
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
This commit is contained in:
parent
0f0b500cf3
commit
fb413981d3
|
@ -1 +1,2 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
/build
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#
|
||||||
|
# github.com/docker/cli
|
||||||
|
#
|
||||||
|
|
||||||
|
.PHONY: build clean cross
|
||||||
|
|
||||||
|
# build the CLI
|
||||||
|
build: clean
|
||||||
|
@go build -o ./build/docker ./cmd/docker
|
||||||
|
|
||||||
|
# remove build artifacts
|
||||||
|
clean:
|
||||||
|
@rm -rf ./build
|
||||||
|
|
||||||
|
# build the CLI for multiple architectures
|
||||||
|
cross: clean
|
||||||
|
@gox -output build/docker-{{.OS}}-{{.Arch}} \
|
||||||
|
-osarch="linux/arm linux/amd64 darwin/amd64 windows/amd64" \
|
||||||
|
./cmd/docker
|
51
README.md
51
README.md
|
@ -10,6 +10,57 @@ It's composed of 3 main folders
|
||||||
* `/client` - the API client, used by `/cli`.
|
* `/client` - the API client, used by `/cli`.
|
||||||
* `/cmd/docker` - the entrypoint of the cli, aka the main.
|
* `/cmd/docker` - the entrypoint of the cli, aka the main.
|
||||||
|
|
||||||
|
Development
|
||||||
|
===========
|
||||||
|
|
||||||
|
### Build locally
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make build
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make clean
|
||||||
|
```
|
||||||
|
|
||||||
|
You will need [gox](https://github.com/mitchellh/gox) for this one:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make cross
|
||||||
|
```
|
||||||
|
|
||||||
|
If you don't have [gox](https://github.com/mitchellh/gox), you can use the "in-container" version of `make cross`, listed below.
|
||||||
|
|
||||||
|
### Build inside container
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make -f docker.Makefile build
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make -f docker.Makefile clean
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make -f docker.Makefile cross
|
||||||
|
```
|
||||||
|
|
||||||
|
### In-container development environment
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make -f docker.Makefile dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you can use the [build locally](#build-locally) commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make build
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make clean
|
||||||
|
```
|
||||||
|
|
||||||
Legal
|
Legal
|
||||||
=====
|
=====
|
||||||
*Brought to you courtesy of our legal counsel. For more context,
|
*Brought to you courtesy of our legal counsel. For more context,
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#
|
||||||
|
# github.com/docker/cli
|
||||||
|
#
|
||||||
|
# Makefile for developing using Docker
|
||||||
|
#
|
||||||
|
|
||||||
|
+.PHONY: build_docker_image build clean cross dev
|
||||||
|
|
||||||
|
DEV_DOCKER_IMAGE_NAME = docker_cli_dev
|
||||||
|
|
||||||
|
# build docker image (dockerfiles/Dockerfile.build)
|
||||||
|
build_docker_image:
|
||||||
|
@docker build -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.build . > /dev/null
|
||||||
|
|
||||||
|
# build executable using a container
|
||||||
|
build: build_docker_image
|
||||||
|
@echo "WARNING: this will drop a Linux executable on your host (not a macOS of Windows one)"
|
||||||
|
@docker run --rm -v `pwd`:/go/src/github.com/docker/cli $(DEV_DOCKER_IMAGE_NAME) make build
|
||||||
|
|
||||||
|
# clean build artifacts using a container
|
||||||
|
clean: build_docker_image
|
||||||
|
@docker run --rm -v `pwd`:/go/src/github.com/docker/cli $(DEV_DOCKER_IMAGE_NAME) make clean
|
||||||
|
|
||||||
|
# build the CLI for multiple architectures using a container
|
||||||
|
cross: build_docker_image
|
||||||
|
@docker run --rm -v `pwd`:/go/src/github.com/docker/cli $(DEV_DOCKER_IMAGE_NAME) make cross
|
||||||
|
|
||||||
|
# start container in interactive mode for in-container development
|
||||||
|
dev: build_docker_image
|
||||||
|
@docker run -ti -v `pwd`:/go/src/github.com/docker/cli $(DEV_DOCKER_IMAGE_NAME) ash
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
FROM golang:1.8-alpine
|
FROM golang:1.8-alpine
|
||||||
|
|
||||||
RUN apk add -U git
|
RUN apk add -U git make
|
||||||
|
|
||||||
RUN go get github.com/LK4D4/vndr && \
|
RUN go get github.com/LK4D4/vndr && \
|
||||||
cp /go/bin/vndr /usr/bin && \
|
cp /go/bin/vndr /usr/bin && \
|
||||||
|
|
Loading…
Reference in New Issue