-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace docker.Makefile with a bash script.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
- Loading branch information
Showing
5 changed files
with
63 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
FROM golang:1.8-alpine | ||
|
||
RUN apk add -U git | ||
RUN apk add -U git make | ||
|
||
RUN go get -u gopkg.in/alecthomas/gometalinter.v1 && \ | ||
mv /go/bin/gometalinter.v1 /usr/local/bin/gometalinter && \ | ||
gometalinter --install | ||
|
||
WORKDIR /go/src/github.com/docker/cli | ||
ENTRYPOINT ["/usr/local/bin/gometalinter"] | ||
CMD ["--config=gometalinter.json", "./..."] | ||
CMD ["/usr/local/bin/gometalinter", "--config=gometalinter.json", "./..."] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu -o pipefail | ||
|
||
dev_image=docker-cli-dev | ||
linter_image=docker-cli-lint | ||
cross_image=docker-cli-cross | ||
mounts="-v $PWD:/go/src/github.com/docker/cli" | ||
|
||
if [ -t 1 ] ; then use_tty="-ti"; else use_tty=""; fi | ||
|
||
function run_task { | ||
local task=$1 | ||
|
||
if [[ "$task" = *shell ]]; then | ||
local cmd=sh | ||
else | ||
local cmd="make $task" | ||
fi | ||
|
||
case $task in | ||
lint|lint-shell) | ||
docker build -t "$linter_image" -f ./dockerfiles/Dockerfile.lint . | ||
docker run --rm $use_tty $mounts "$linter_image" $cmd | ||
;; | ||
cross|dynbinary|cross-shell) | ||
docker build -t "$cross_image" -f ./dockerfiles/Dockerfile.cross . | ||
docker run --rm $use_tty $mounts "$cross_image" $cmd | ||
;; | ||
*) | ||
docker build -t "$dev_image" -f ./dockerfiles/Dockerfile.dev . | ||
docker run --rm $use_tty $mounts "$dev_image" $cmd | ||
;; | ||
esac | ||
} | ||
|
||
function usage { | ||
cat <<USAGE | ||
Usage: $0 TASK [TASK...] | ||
Run a project task in the appropriate Docker image. | ||
TASK may be the name of a target in the Makefile or one of: | ||
shell, lint-shell, cross-shell | ||
USAGE | ||
exit 1 | ||
} | ||
|
||
if [ -z "$@" ] || [ "$@" = "--help" ]; then usage; fi | ||
|
||
for task in $@; do | ||
run_task $task | ||
done |