mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-09-08 02:10:00 +00:00
Out with the old, in with the new Moby
- remove remainder of editions code - add a new check container to run tests without Docker - switch over `make test` to use new command to build tests Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
FROM golang:1.8-alpine
|
||||
RUN apk update && apk add --no-cache build-base git
|
||||
|
||||
FROM alpine:3.5
|
||||
RUN apk update && apk add --no-cache build-base git go
|
||||
ENV GOPATH=/go PATH=$PATH:/go/bin
|
||||
RUN go get -u github.com/golang/lint/golint
|
||||
|
||||
COPY compile.sh /usr/bin/
|
||||
COPY . ./
|
||||
|
||||
ENTRYPOINT ["/usr/bin/compile.sh"]
|
||||
ENTRYPOINT ["/compile.sh"]
|
||||
|
@@ -1,6 +1,6 @@
|
||||
.PHONY: tag push
|
||||
|
||||
BASE=golang:1.8-alpine
|
||||
BASE=alpine:3.5
|
||||
IMAGE=go-compile
|
||||
|
||||
default: push
|
||||
@@ -8,7 +8,7 @@ default: push
|
||||
hash: Dockerfile compile.sh
|
||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
||||
docker run --rm --entrypoint=/bin/sh $(IMAGE):build -c 'cat /usr/local/go/bin/go /lib/apk/db/installed /go/bin/golint /usr/bin/compile.sh | sha1sum' | sed 's/ .*//' > hash
|
||||
docker run --rm --entrypoint=/bin/sh $(IMAGE):build -c "cat $^ /lib/apk/db/installed /go/bin/golint | sha1sum" | sed 's/ .*//' > hash
|
||||
|
||||
push: hash
|
||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||
|
@@ -3,7 +3,6 @@
|
||||
# This is designed to compile a single package to a single binary
|
||||
# so it makes some assumptions about things to simplify config
|
||||
# to output a single binary (in a tarball) just use -o file
|
||||
# use --docker to output a tarball for input to docker build -
|
||||
|
||||
set -e
|
||||
|
||||
@@ -23,6 +22,10 @@ do
|
||||
mkdir -p "$(dirname $2)"
|
||||
shift
|
||||
;;
|
||||
--package)
|
||||
package="$2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
@@ -33,7 +36,7 @@ done
|
||||
[ $# -gt 0 ] && usage
|
||||
[ -z "$out" ] && usage
|
||||
|
||||
package=$(basename "$out")
|
||||
[ -z "$package" ] && package=$(basename "$out")
|
||||
|
||||
dir="$GOPATH/src/$package"
|
||||
|
||||
@@ -46,16 +49,21 @@ cd $dir
|
||||
|
||||
# lint before building
|
||||
>&2 echo "gofmt..."
|
||||
test -z $(gofmt -s -l .| grep -v .pb. | grep -v */vendor/ | tee /dev/stderr)
|
||||
test -z $(gofmt -s -l .| grep -v .pb. | grep -v vendor/ | tee /dev/stderr)
|
||||
|
||||
>&2 echo "govet..."
|
||||
test -z $(go tool vet -printf=false . 2>&1 | grep -v */vendor/ | tee /dev/stderr)
|
||||
test -z $(GOOS=linux go tool vet -printf=false . 2>&1 | grep -v vendor/ | tee /dev/stderr)
|
||||
|
||||
>&2 echo "golint..."
|
||||
test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)
|
||||
|
||||
>&2 echo "go build..."
|
||||
|
||||
go build -o $out -buildmode pie --ldflags '-extldflags "-static"' "$package"
|
||||
if [ "$GOOS" = "darwin" ]
|
||||
then
|
||||
go build -o $out "$package"
|
||||
else
|
||||
go build -o $out -buildmode pie --ldflags '-extldflags "-static"' "$package"
|
||||
fi
|
||||
|
||||
tar cf - $out
|
||||
|
Reference in New Issue
Block a user