inline compile script

master
Bel LaPointe 2019-01-14 09:41:34 -07:00
parent 94b257ad4d
commit 3da2eece62
1 changed files with 2 additions and 16 deletions

18
do.sh
View File

@ -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