diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..a4180e0 --- /dev/null +++ b/go.mod @@ -0,0 +1,32 @@ +module github.com/sassoftware/relic + +require ( + github.com/beevik/etree v1.1.0 + github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668 + github.com/danieljoos/wincred v1.0.2 // indirect + github.com/godbus/dbus v4.1.0+incompatible // indirect + github.com/golang/snappy v0.0.1 + github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c + github.com/kr/pretty v0.1.0 + github.com/lib/pq v1.2.0 + github.com/miekg/pkcs11 v1.0.2 + github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect + github.com/pkg/errors v0.8.1 + github.com/qur/ar v0.0.0-20130629153254-282534b91770 + github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b + github.com/satori/go.uuid v1.2.0 + github.com/spf13/cobra v0.0.5 + github.com/spf13/pflag v1.0.3 + github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94 + github.com/stretchr/objx v0.2.0 // indirect + github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 + github.com/zalando/go-keyring v0.0.0-20190715212148-76787ff3b3bd + golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 + golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 + golang.org/x/sync v0.0.0-20190423024810-112230192c58 + golang.org/x/sys v0.0.0-20190730183949-1393eb018365 + golang.org/x/text v0.3.2 // indirect + golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + gopkg.in/yaml.v2 v2.2.2 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..35d4d1f --- /dev/null +++ b/go.sum @@ -0,0 +1,99 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= +github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= +github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668 h1:U/lr3Dgy4WK+hNk4tyD+nuGjpVLPEHuJSFXMw11/HPA= +github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= +github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/godbus/dbus v4.1.0+incompatible h1:WqqLRTsQic3apZUK9qC5sGNfXthmPXzUZ7nQPrNITa4= +github.com/godbus/dbus v4.1.0+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0= +github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/miekg/pkcs11 v1.0.2 h1:CIBkOawOtzJNE0B+EpRiUBzuVW7JEQAwdwhSS6YhIeg= +github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/qur/ar v0.0.0-20130629153254-282534b91770 h1:A6sXY4zAECrW5Obx41PVMGr4kOw1rd1kmwcHa5M0dTg= +github.com/qur/ar v0.0.0-20130629153254-282534b91770/go.mod h1:SjlYv2m9lpV0UW6K7lDqVJwEIIvSjaHbGk7nIfY8Hxw= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b h1:+gCnWOZV8Z/8jehJ2CdqB47Z3S+SREmQcuXkRFLNsiI= +github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b/go.mod h1:am+Fp8Bt506lA3Rk3QCmSqmYmLMnPDhdDUcosQCAx+I= +github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94 h1:0ngsPmuP6XIjiFRNFYlvKwSr5zff2v+uPHaffZ6/M4k= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/zalando/go-keyring v0.0.0-20190715212148-76787ff3b3bd h1:k2mK+6Pav9LdENQAiOoKobDd6O7u+xSX365cMYfv/O0= +github.com/zalando/go-keyring v0.0.0-20190715212148-76787ff3b3bd/go.mod h1:XlXBIfkGawHNVOHlenOaBW7zlfCh8LovwjOgjamYnkQ= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190730183949-1393eb018365 h1:SaXEMXhWzMJThc05vu6uh61Q245r4KaWMrsTedk0FDc= +golang.org/x/sys v0.0.0-20190730183949-1393eb018365/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/jenkins.sh b/jenkins.sh deleted file mode 100755 index 937e7f3..0000000 --- a/jenkins.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# -# Copyright (c) SAS Institute Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -module=github.com/sassoftware/relic - -set -e -WORKDIR=$(pwd) -export PATH=$GOROOT/bin:$PATH -rm -rf $WORKDIR/build -mkdir -p $WORKDIR/build - -if [ -n "${VENDORIZER:-}" ] -then - curl -sOz ./vendorizer "$VENDORIZER/vendorizer" - chmod a+rx vendorizer - vz="$WORKDIR/vendorizer ensure -u $VENDORIZER" -else - type -P dep >/dev/null || go get -v github.com/golang/dep/cmd/dep - vz="dep ensure -vendor-only" -fi - -# Setup GOPATH -SRCDIR=$(cd $(dirname $0) && pwd) -export GOPATH=$WORKDIR/build/go -version=$(cd "$SRCDIR" && git describe --tags |sed -e 's/-\([0-9]*\).*/.\1/') -[ -n "$version" ] || { echo Unable to determine version; exit 1; } -ldflags="-X ${module}/config.Version=$version" -echo "Version: $version" -echo "Go version: $(go version)" -mkdir -p $GOPATH/src/$(dirname $module) -ln -sfn $SRCDIR $GOPATH/src/$module - -echo setting up build directory -cd $GOPATH/src/$module -$vz -# Block access to unvendored libs from this point on -export GIT_ALLOW_PROTOCOL=none - -# Make sure version gets updated -echo building -touch $GOPATH/src/$module/config/config.go -GOOS=linux go build -v -ldflags "$ldflags" -o $WORKDIR/build/relic $module -GOOS=windows go build -v -ldflags "$ldflags" -o $WORKDIR/build/relic.exe -tags clientonly $module - -cd $WORKDIR/build -rhname=relic-redhat-$version -mkdir relic-redhat-$version -cp -a $SRCDIR/distro/linux/* relic $rhname/ -sed -i -e "s/^Version:.*/Version: $version/" $rhname/relic.spec -tar -czf ${rhname}.tar.gz $rhname - -rm -rf $rhname diff --git a/scripts/Dockerfile.clientbuild b/scripts/Dockerfile.clientbuild index 44248d7..773139e 100644 --- a/scripts/Dockerfile.clientbuild +++ b/scripts/Dockerfile.clientbuild @@ -1,15 +1,16 @@ -FROM golang:latest -RUN wget -q https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 -O /usr/bin/dep && chmod a+rx /usr/bin/dep - -WORKDIR $GOPATH/src/github.com/sassoftware/relic -COPY Gopkg.toml Gopkg.lock ./ -RUN dep ensure -vendor-only +ARG goversion +FROM golang:${goversion} +WORKDIR /src +ENV GO111MODULE=on CGO_ENABLED=0 +ARG GOPROXY +COPY go.mod go.sum ./ +RUN go mod download COPY . . RUN mkdir /out ARG ldflags -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix nocgo -ldflags "$ldflags" -tags clientonly -o /out/relic-client-linux-amd64 -RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -installsuffix nocgo -ldflags "$ldflags" -tags clientonly -o /out/relic-client-linux-arm64 -RUN CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -a -installsuffix nocgo -ldflags "$ldflags" -tags clientonly -o /out/relic-client-linux-ppc64le -RUN CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -installsuffix nocgo -ldflags "$ldflags" -tags clientonly -o /out/relic-client-darwin-amd64 -RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -installsuffix nocgo -ldflags "$ldflags" -tags clientonly -o /out/relic-client-windows-amd64.exe +RUN GOOS=linux GOARCH=amd64 go build -ldflags "$ldflags" -tags clientonly -o /out/relic-client-linux-amd64 +RUN GOOS=linux GOARCH=arm64 go build -ldflags "$ldflags" -tags clientonly -o /out/relic-client-linux-arm64 +RUN GOOS=linux GOARCH=ppc64le go build -ldflags "$ldflags" -tags clientonly -o /out/relic-client-linux-ppc64le +RUN GOOS=darwin GOARCH=amd64 go build -ldflags "$ldflags" -tags clientonly -o /out/relic-client-darwin-amd64 +RUN GOOS=windows GOARCH=amd64 go build -ldflags "$ldflags" -tags clientonly -o /out/relic-client-windows-amd64.exe diff --git a/scripts/Dockerfile.fullbuild b/scripts/Dockerfile.fullbuild new file mode 100644 index 0000000..fff536f --- /dev/null +++ b/scripts/Dockerfile.fullbuild @@ -0,0 +1,18 @@ +FROM fedora:30 +WORKDIR /scratch +RUN dnf install -y wget git gcc mingw64-gcc +ARG goversion +RUN wget -q https://dl.google.com/go/go${goversion}.linux-amd64.tar.gz && tar -xf go*.tar.gz -C /opt +ENV PATH=/opt/go/bin:/usr/bin:/usr/sbin + +WORKDIR /src +ENV GO111MODULE=on CGO_ENABLED=1 +ARG GOPROXY +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . +RUN mkdir /out +ARG ldflags +RUN GOOS=linux GOARCH=amd64 CC=x86_64-redhat-linux-gcc go build -ldflags "$ldflags" -o /out/relic-linux-amd64 +RUN GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc go build -ldflags "$ldflags" -o /out/relic-windows-amd64.exe diff --git a/scripts/build-all.sh b/scripts/build-all.sh index 5b8a466..6bbf97a 100755 --- a/scripts/build-all.sh +++ b/scripts/build-all.sh @@ -18,6 +18,7 @@ set -ex -o pipefail version=$(./scripts/version.sh) commit=$(git rev-parse HEAD) ldflags="-s -w -X github.com/sassoftware/relic/config.Version=$version -X github.com/sassoftware/relic/config.Commit=$commit" +goversion=1.12.7 rm -rf build mkdir build @@ -27,6 +28,8 @@ docker rmi relic-build 2>/dev/null ||: docker build \ -f scripts/Dockerfile.clientbuild \ --build-arg ldflags="$ldflags" \ + --build-arg GOPROXY=$GOPROXY \ + --build-arg goversion=$goversion \ -t relic-build . container=$(docker create relic-build) docker cp $container:out build/ @@ -34,17 +37,16 @@ docker rm $container docker rmi relic-build ## cgo build of full program -# build libtool-ltdl as a static library so no deps other than libc are needed -xgo \ - --targets=linux/amd64,darwin/amd64,windows/amd64 \ - --deps="http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz" \ - --depsargs=--disable-shared \ - --out="build/relic" \ - -ldflags "$ldflags" \ - . -sudo chown $(id -u) build/* +docker build \ + -f scripts/Dockerfile.fullbuild \ + --build-arg ldflags="$ldflags" \ + --build-arg GOPROXY=$GOPROXY \ + --build-arg goversion=$goversion \ + -t relic-build . +container=$(docker create relic-build) +docker cp $container:out build/ +docker rm $container +docker rmi relic-build -mv build/relic-darwin-*-amd64 build/relic-darwin-amd64 -mv build/relic-windows-*-amd64.exe build/relic-windows-amd64.exe mv build/out/* build/ rmdir build/out