Merge pull request #1865 from justincormack/go-compile

more Go compile fixes
This commit is contained in:
Rolf Neugebauer 2017-05-21 11:18:45 +01:00 committed by GitHub
commit a6d834ddf0
28 changed files with 51 additions and 87 deletions

View File

@ -5,7 +5,7 @@ all: default
VERSION="0.0" # dummy for now
GIT_COMMIT=$(shell git rev-list -1 HEAD)
GO_COMPILE=linuxkit/go-compile:5bf17af781df44f07906099402680b9a661f999b
GO_COMPILE=linuxkit/go-compile:3ba94f14de51b73551417e769d122815ec917ee7
MOBY?=bin/moby
LINUXKIT?=bin/linuxkit

View File

@ -8,9 +8,9 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: sysfs
image: linuxkit/sysfs:6c1d06f28ddd9681799d3950cddf044b930b221c
image: linuxkit/sysfs:1cde5876d44117af61dfea629ad922defcd48808
- name: binfmt
image: "linuxkit/binfmt:548f7f044f5411a8938913527c5ce55d9876bb07"
binds:

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: dhcpcd
image: "linuxkit/dhcpcd:cb96c09a33c166eca6530f166f0f79927c3e83b0"
binds:

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
services:
- name: rngd
image: "linuxkit/rngd:c97ef16be340884a985d8b025983505a9bcc51f0"

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
services:
- name: rngd
image: "linuxkit/rngd:c97ef16be340884a985d8b025983505a9bcc51f0"

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:eabc5a6e59f05aa91529d80e9a595b85b046f935
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: binfmt
image: "linuxkit/binfmt:548f7f044f5411a8938913527c5ce55d9876bb07"
binds:

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
services:
- name: rngd
image: "linuxkit/rngd:c97ef16be340884a985d8b025983505a9bcc51f0"

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: binfmt
image: "linuxkit/binfmt:548f7f044f5411a8938913527c5ce55d9876bb07"
binds:

View File

@ -1,4 +0,0 @@
dev
proc
sys
usr

View File

@ -1,4 +1,4 @@
FROM linuxkit/alpine:6fd232518678407a5ce4b31f7e21e07a883b4ba4@sha256:f5084a6b1716dd931749d1308529ee904f87fa74a5a9523f23046c4a1215424e AS mirror
FROM linuxkit/alpine:5f6db26ab7bf6a9c452a612e236cc7495408132b@sha256:d009afc85d0b005daf51c8f3026aa552ab997dc47cab43915e9dc761accae086 AS mirror
RUN apk add --no-cache go musl-dev
ENV GOPATH=/go PATH=$PATH:/go/bin

View File

@ -1,4 +0,0 @@
dev
proc
sys
usr

View File

@ -1,3 +1,15 @@
FROM linuxkit/alpine:5f6db26ab7bf6a9c452a612e236cc7495408132b@sha256:d009afc85d0b005daf51c8f3026aa552ab997dc47cab43915e9dc761accae086 AS mirror
RUN apk add --no-cache go musl-dev
ENV GOPATH=/go PATH=$PATH:/go/bin
COPY main.go /go/src/sysfs/
RUN go-compile.sh /go/src/sysfs
FROM scratch
COPY . ./
ENTRYPOINT []
CMD []
WORKDIR /
COPY --from=mirror /go/bin/sysfs /usr/bin/sysfs
COPY etc/ /etc/
CMD ["/usr/bin/sysfs"]

View File

@ -1,45 +1,15 @@
GO_COMPILE=linuxkit/go-compile:4513068d9a7e919e4ec42e2d7ee879ff5b95b7f5@sha256:bdfadbe3e4ec699ca45b67453662321ec270f2d1a1dbdbf09625776d3ebd68c5
SHA_IMAGE=alpine:3.5@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8
SYSFS_BINARY=usr/bin/sysfs
.PHONY: tag push
default: push
ORG?=linuxkit
IMAGE=sysfs
DEPS=Dockerfile Makefile main.go
.PHONY: tag push clean container
default: push
HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
$(SYSFS_BINARY): main.go
mkdir -p $(dir $@)
tar cf - $^ | docker run --rm --net=none --log-driver=none -i $(GO_COMPILE) -o $@ | tar xf -
tag: $(DEPS)
docker build --squash --no-cache --network=none -t $(ORG)/$(IMAGE):$(HASH) .
DIRS=dev proc sys
$(DIRS):
mkdir -p $@
DEPS=$(DIRS) $(SYSFS_BINARY) etc/sysfs.d/00-moby.conf
container: Dockerfile $(DEPS)
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
hash: Dockerfile $(DEPS)
find $^ -type f | xargs cat | docker run --rm -i $(SHA_IMAGE) sha1sum - | sed 's/ .*//' > hash
push: hash container
docker pull $(ORG)/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build $(ORG)/$(IMAGE):$(shell cat hash) && \
docker push $(ORG)/$(IMAGE):$(shell cat hash))
docker rmi $(IMAGE):build
rm -f hash
tag: hash container
docker pull $(ORG)/$(IMAGE):$(shell cat hash) || \
docker tag $(IMAGE):build $(ORG)/$(IMAGE):$(shell cat hash)
docker rmi $(IMAGE):build
rm -f hash
clean:
rm -rf hash $(DIRS) usr
.DELETE_ON_ERROR:
push: tag
docker pull $(ORG)/$(IMAGE):$(HASH) || \
docker push $(ORG)/$(IMAGE):$(HASH)

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: format
image: "linuxkit/format:d78093e943f9c88386e30c00353f9476d34fb551"
binds:

View File

@ -8,7 +8,7 @@ init:
- mobylinux/ca-certificates:eabc5a6e59f05aa91529d80e9a595b85b046f935
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: dhcpcd
image: "linuxkit/dhcpcd:cb96c09a33c166eca6530f166f0f79927c3e83b0"
binds:

View File

@ -9,7 +9,7 @@ init:
- linuxkit/ima-utils:fe119c7dac08884f4144cd106dc279ddd8b37517
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: binfmt
image: "linuxkit/binfmt:131026c0cf6084467316395fed3b358f64bda00c"
binds:

View File

@ -8,9 +8,9 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: sysfs
image: linuxkit/sysfs:6c1d06f28ddd9681799d3950cddf044b930b221c
image: linuxkit/sysfs:1cde5876d44117af61dfea629ad922defcd48808
- name: binfmt
image: "linuxkit/binfmt:548f7f044f5411a8938913527c5ce55d9876bb07"
binds:

View File

@ -8,9 +8,9 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: sysfs
image: linuxkit/sysfs:6c1d06f28ddd9681799d3950cddf044b930b221c
image: linuxkit/sysfs:1cde5876d44117af61dfea629ad922defcd48808
- name: binfmt
image: "linuxkit/binfmt:548f7f044f5411a8938913527c5ce55d9876bb07"
binds:

View File

@ -9,7 +9,7 @@ init:
- linuxkit/memlogd:9b5834189f598f43c507f6938077113906f51012
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: binfmt
image: "linuxkit/binfmt:548f7f044f5411a8938913527c5ce55d9876bb07"
binds:

View File

@ -8,7 +8,7 @@ init:
- mobylinux/ca-certificates:eabc5a6e59f05aa91529d80e9a595b85b046f935
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: binfmt
image: linuxkit/binfmt:548f7f044f5411a8938913527c5ce55d9876bb07
binds:

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
services:
- name: rngd
image: "linuxkit/rngd:3dad6dd43270fa632ac031e99d1947f20b22eec9"

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: dhcpcd
image: "linuxkit/dhcpcd:cb96c09a33c166eca6530f166f0f79927c3e83b0"
binds:

View File

@ -8,9 +8,9 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: sysfs
image: "linuxkit/sysfs:6c1d06f28ddd9681799d3950cddf044b930b221c"
image: "linuxkit/sysfs:1cde5876d44117af61dfea629ad922defcd48808"
- name: binfmt
image: "linuxkit/binfmt:548f7f044f5411a8938913527c5ce55d9876bb07"
binds:

View File

@ -8,7 +8,7 @@ init:
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: sysctl
image: "linuxkit/sysctl:13a37b8d38fbec34d8c7d3bd4dadb57c9f92c94c"
image: "linuxkit/sysctl:225c52c2d6f04a040663bac84cabf81825027f64"
- name: test
image: "linuxkit/test-sysctl:c4df4c4d692904d6245dcdef1f4a79389bd3d894"
- name: poweroff

View File

@ -27,7 +27,7 @@ RUN echo "/mirror" > /etc/apk/repositories && apk update
# add Go validation tools
COPY go-compile.sh /go/bin/
RUN apk add --no-cache build-base git go
RUN apk add --no-cache git go musl-dev
ENV GOPATH=/go PATH=$PATH:/go/bin
RUN go get -u github.com/golang/lint/golint
RUN go get -u github.com/gordonklaus/ineffassign

View File

@ -33,14 +33,4 @@ go test
export CGO_ENABLED=0
if [ "$GOOS" = "darwin" -o "$GOOS" = "windows" ]
then
if [ -z "$ldflags" ]
then
go install
else
go install -ldflags "${ldflags}"
fi
else
go install -buildmode pie -ldflags "-s -w ${ldflags} -extldflags \"-fno-PIC -static\""
fi
go install -buildmode pie -ldflags "-s -w ${ldflags} -extldflags \"-fno-PIC -static\""

View File

@ -113,7 +113,7 @@ lzo-2.10-r0
m4-1.4.18-r0
make-4.2.1-r0
mesa-gbm-17.0.3-r1
mkinitfs-3.0.9-r1
mkinitfs-3.1.0_rc1-r0
mpc1-1.0.3-r0
mpfr3-3.1.5-r0
mtools-4.0.18-r1
@ -136,7 +136,7 @@ patch-2.7.5-r1
pcre-8.40-r2
perl-5.24.1-r2
pixman-0.34.0-r0
pkgconf-1.3.6-r0
pkgconf-1.3.7-r0
popt-1.16-r6
qemu-2.8.1-r1
qemu-aarch64-2.8.1-r1

View File

@ -88,7 +88,7 @@ test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*
>&2 echo "go build..."
if [ "$GOOS" = "darwin" ]
if [ "$GOOS" = "darwin" -o "$GOOS" = "windows" ]
then
if [ -z "$ldflags" ]
then