inline compile script
parent
94b257ad4d
commit
3da2eece62
18
do.sh
18
do.sh
|
|
@ -6,17 +6,14 @@ function main() {
|
|||
thispkg="${PWD##*$GOPATH/}"
|
||||
thisexec="$(basename "$thispkg")"
|
||||
function cleanup() {
|
||||
rm "$compile"
|
||||
rm "$dockfile"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ "$(uname -s)" == "Darwin" ]; then
|
||||
compile="$(mktemp -t . tmpXXXXX | tail -n 1)"
|
||||
dockfile="$(mktemp -t . tmpXXXX | tail -n 1)"
|
||||
echo ,"$compile", ."$dockfile".
|
||||
echo "$dockfile"
|
||||
else
|
||||
compile="$(mktemp -p . tmpXXXXX)"
|
||||
dockfile="$(mktemp -p . tmpXXXX)"
|
||||
fi
|
||||
|
||||
|
|
@ -141,17 +138,6 @@ function py2_dockerfiles() {
|
|||
}
|
||||
|
||||
function go_dockerfiles() {
|
||||
echo '
|
||||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
go get -d ./...
|
||||
|
||||
CGO_ENABLED=0 go build -o /go/bin/'"$thisexec"' -a -installsuffix cgo
|
||||
' > "$compile"
|
||||
|
||||
from="golang:1.10-alpine"
|
||||
if [ "$(uname -s)" == "Darwin" ]; then
|
||||
from="registry-app.eng.qops.net:5001/imported/alpine/golang:1.10-alpine"
|
||||
|
|
@ -165,7 +151,7 @@ RUN apk add --no-cache git
|
|||
|
||||
WORKDIR /go/'"$thispkg"'
|
||||
COPY . .
|
||||
RUN /bin/sh '"$compile"'
|
||||
RUN /bin/sh -c "CGO_ENABLED=0 go build -o /go/bin/exec -a -installsuffix cgo"
|
||||
|
||||
FROM alpine as certs
|
||||
RUN apk update && apk add ca-certificates
|
||||
|
|
|
|||
Loading…
Reference in New Issue