mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-27 12:38:11 +00:00
Move linting to Go build
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
This commit is contained in:
parent
b73d2a29a7
commit
c8e7a6dd43
@ -1,2 +1,8 @@
|
|||||||
FROM golang:1.7-alpine
|
FROM golang:1.7-alpine
|
||||||
RUN apk update && apk add --no-cache build-base git
|
RUN apk update && apk add --no-cache build-base git
|
||||||
|
|
||||||
|
# Get linting tools
|
||||||
|
RUN go get -u github.com/golang/lint/golint
|
||||||
|
|
||||||
|
# Get the linting script and place in PATH
|
||||||
|
COPY lint.sh /usr/bin/lint.sh
|
@ -7,8 +7,8 @@ default: push
|
|||||||
|
|
||||||
hash:
|
hash:
|
||||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
||||||
tar cf - Dockerfile | docker build --no-cache -t $(IMAGE):build -
|
tar cf - Dockerfile lint.sh | docker build --no-cache -t $(IMAGE):build -
|
||||||
docker run --rm $(IMAGE):build sh -c 'cat /usr/local/go/bin/go /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > hash
|
docker run --rm $(IMAGE):build sh -c 'cat /usr/local/go/bin/go /lib/apk/db/installed /usr/bin/lint.sh /go/bin/golint | sha1sum' | sed 's/ .*//' > hash
|
||||||
|
|
||||||
push: hash
|
push: hash
|
||||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd /src
|
cd $1
|
||||||
|
|
||||||
>&2 echo "gofmt..."
|
>&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)
|
@ -1,11 +0,0 @@
|
|||||||
FROM golang:1.7-alpine
|
|
||||||
RUN apk update && apk add --no-cache build-base git
|
|
||||||
|
|
||||||
# Get linting tools
|
|
||||||
RUN go get -u github.com/golang/lint/golint
|
|
||||||
|
|
||||||
# Get the linting script and make its source dir
|
|
||||||
COPY lint.sh .
|
|
||||||
RUN mkdir /src
|
|
||||||
|
|
||||||
CMD ["./lint.sh", "/src"]
|
|
@ -1,29 +0,0 @@
|
|||||||
.PHONY: tag push
|
|
||||||
|
|
||||||
BASE=golang:1.7-alpine
|
|
||||||
IMAGE=alpine-go-lint
|
|
||||||
|
|
||||||
default: push
|
|
||||||
|
|
||||||
hash:
|
|
||||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
|
||||||
tar cf - Dockerfile | docker build --no-cache -t $(IMAGE):build .
|
|
||||||
docker run --rm $(IMAGE):build sh -c 'cat /go/lint.sh /usr/local/go/bin/go /lib/apk/db/installed /go/bin/golint | sha1sum' | sed 's/ .*//' > hash
|
|
||||||
|
|
||||||
push: hash
|
|
||||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
|
||||||
(docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
|
|
||||||
docker push mobylinux/$(IMAGE):$(shell cat hash))
|
|
||||||
docker rmi $(IMAGE):build
|
|
||||||
rm -f hash
|
|
||||||
|
|
||||||
tag: hash
|
|
||||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
|
||||||
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash)
|
|
||||||
docker rmi $(IMAGE):build
|
|
||||||
rm -f hash
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f hash
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
|
@ -1,5 +1,5 @@
|
|||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY *.go /go/src/binfmt/
|
COPY *.go /go/src/binfmt/
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY ./ /go/src/diagnostics-server/
|
COPY ./ /go/src/diagnostics-server/
|
||||||
|
|
||||||
WORKDIR /go/src/diagnostics-server
|
WORKDIR /go/src/diagnostics-server
|
||||||
|
|
||||||
|
RUN lint.sh .
|
||||||
|
|
||||||
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
||||||
|
|
||||||
CMD ["tar", "cf", "-", "-C", "/go/bin", "diagnostics-server"]
|
CMD ["tar", "cf", "-", "-C", "/go/bin", "diagnostics-server"]
|
||||||
|
@ -2,10 +2,7 @@ all: usr/bin/diagnostics-server
|
|||||||
|
|
||||||
DEPS=Dockerfile $(wildcard *.go)
|
DEPS=Dockerfile $(wildcard *.go)
|
||||||
|
|
||||||
# Tag: 02a04b2dc262195773b29125daebca0eebd97845
|
usr/bin/diagnostics-server: $(DEPS) ../vendor/manifest
|
||||||
LINT_IMAGE=mobylinux/alpine-go-lint@sha256:3009197c25294d87a7e81a53493666de47ed2b55a5bd283eabad4b876ea64559
|
|
||||||
|
|
||||||
usr/bin/diagnostics-server: $(DEPS) ../vendor/manifest lint
|
|
||||||
BUILD=$$( tar cf - $(DEPS) -C .. vendor | docker build -q - ) && \
|
BUILD=$$( tar cf - $(DEPS) -C .. vendor | docker build -q - ) && \
|
||||||
[ -n "$$BUILD" ] && \
|
[ -n "$$BUILD" ] && \
|
||||||
echo "Built $$BUILD" && \
|
echo "Built $$BUILD" && \
|
||||||
@ -14,7 +11,4 @@ usr/bin/diagnostics-server: $(DEPS) ../vendor/manifest lint
|
|||||||
clean:
|
clean:
|
||||||
rm -f usr/bin/diagnostics-server
|
rm -f usr/bin/diagnostics-server
|
||||||
|
|
||||||
lint:
|
|
||||||
docker run --rm -v $(PWD):/src $(LINT_IMAGE)
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY ./ /go/src/proxy/
|
COPY ./ /go/src/proxy/
|
||||||
|
|
||||||
WORKDIR /go/src/proxy
|
WORKDIR /go/src/proxy
|
||||||
|
|
||||||
|
RUN lint.sh .
|
||||||
|
|
||||||
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
||||||
|
|
||||||
CMD ["tar", "cf", "-", "-C", "/go/bin", "proxy"]
|
CMD ["tar", "cf", "-", "-C", "/go/bin", "proxy"]
|
||||||
|
@ -2,10 +2,7 @@ all: usr/bin/slirp-proxy sbin/proxy-vsockd
|
|||||||
|
|
||||||
DEPS=Dockerfile $(wildcard *.go libproxy/*.go)
|
DEPS=Dockerfile $(wildcard *.go libproxy/*.go)
|
||||||
|
|
||||||
# Tag: 02a04b2dc262195773b29125daebca0eebd97845
|
proxy: $(DEPS) ../vendor/manifest
|
||||||
LINT_IMAGE=mobylinux/alpine-go-lint@sha256:3009197c25294d87a7e81a53493666de47ed2b55a5bd283eabad4b876ea64559
|
|
||||||
|
|
||||||
proxy: $(DEPS) ../vendor/manifest lint
|
|
||||||
BUILD=$$( tar cf - $(DEPS) -C .. vendor | docker build -q - ) && \
|
BUILD=$$( tar cf - $(DEPS) -C .. vendor | docker build -q - ) && \
|
||||||
[ -n "$$BUILD" ] && \
|
[ -n "$$BUILD" ] && \
|
||||||
echo "Built $$BUILD" && \
|
echo "Built $$BUILD" && \
|
||||||
@ -22,7 +19,4 @@ sbin/proxy-vsockd: proxy
|
|||||||
clean:
|
clean:
|
||||||
rm -rf proxy sbin usr
|
rm -rf proxy sbin usr
|
||||||
|
|
||||||
lint:
|
|
||||||
docker run --rm -v $(PWD):/src $(LINT_IMAGE)
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY ./ /go/src/vsudd/
|
COPY ./ /go/src/vsudd/
|
||||||
|
|
||||||
WORKDIR /go/src/vsudd
|
WORKDIR /go/src/vsudd
|
||||||
|
|
||||||
|
RUN lint.sh .
|
||||||
|
|
||||||
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
||||||
|
|
||||||
CMD ["tar", "cf", "-", "-C", "/go/bin", "vsudd"]
|
CMD ["tar", "cf", "-", "-C", "/go/bin", "vsudd"]
|
||||||
|
@ -2,10 +2,7 @@ all: vsudd
|
|||||||
|
|
||||||
DEPS=Dockerfile $(wildcard *.go)
|
DEPS=Dockerfile $(wildcard *.go)
|
||||||
|
|
||||||
# Tag: 02a04b2dc262195773b29125daebca0eebd97845
|
vsudd: $(DEPS) ../vendor/manifest
|
||||||
LINT_IMAGE=mobylinux/alpine-go-lint@sha256:3009197c25294d87a7e81a53493666de47ed2b55a5bd283eabad4b876ea64559
|
|
||||||
|
|
||||||
vsudd: $(DEPS) ../vendor/manifest lint
|
|
||||||
mkdir -p sbin
|
mkdir -p sbin
|
||||||
BUILD=$$( tar cf - $(DEPS) -C .. vendor | docker build -q - ) && \
|
BUILD=$$( tar cf - $(DEPS) -C .. vendor | docker build -q - ) && \
|
||||||
[ -n "$$BUILD" ] && \
|
[ -n "$$BUILD" ] && \
|
||||||
@ -15,7 +12,4 @@ vsudd: $(DEPS) ../vendor/manifest lint
|
|||||||
clean:
|
clean:
|
||||||
rm -rf sbin
|
rm -rf sbin
|
||||||
|
|
||||||
lint:
|
|
||||||
docker run --rm -v $(PWD):/src $(LINT_IMAGE)
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Will do a Go build in future
|
# Will do a Go build in future
|
||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY test.sh mksh /tmp/bin/
|
COPY test.sh mksh /tmp/bin/
|
||||||
COPY ca-certificates.crt /tmp/etc/ssl/certs/ca-certificates.crt
|
COPY ca-certificates.crt /tmp/etc/ssl/certs/ca-certificates.crt
|
||||||
|
Loading…
Reference in New Issue
Block a user