From c8f015930e40b22039779abf59bd4e04bc5c257b Mon Sep 17 00:00:00 2001 From: bel Date: Sat, 22 Jun 2019 16:27:34 -0600 Subject: [PATCH] Build go without a container to avoid vendor --- do.sh | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/do.sh b/do.sh index c5356ef..868422b 100755 --- a/do.sh +++ b/do.sh @@ -141,36 +141,41 @@ function py2_dockerfiles() { } function go_dockerfiles() { + GOOS=linux CGO_ENABLED=0 go build -o ./exec-$thisexec -a -installsuffix cgo + from="golang:1.10-alpine" if [ "$(uname -s)" == "Darwin" ]; then from="registry-app.eng.qops.net:5001/imported/alpine/golang:1.10-alpine" fi -DOCKERFILE=' -FROM '"$from"' as builder -MAINTAINER breel@qualtrics.com - -RUN apk add --no-cache git - -WORKDIR /go/'"$thispkg"' -COPY . . -RUN /bin/sh -c "CGO_ENABLED=0 go build -o /go/bin/'"$thisexec"' -a -installsuffix cgo" - -FROM alpine as certs -RUN apk update && apk add --no-cache ca-certificates +#FROM '"$from"' as builder +#MAINTAINER breel@qualtrics.com +# +#RUN apk add --no-cache git +# +#WORKDIR /go/'"$thispkg"' +#COPY . . +#RUN /bin/sh -c "CGO_ENABLED=0 go build -o /go/bin/'"$thisexec"' -a -installsuffix cgo" +# +#FROM busybox:glibc +#COPY --from=builder /go/'"$thispkg"' /main +#COPY --from=builder /go/bin /main #======================== +DOCKERFILE=' +FROM alpine as certs +RUN apk update && apk add --no-cache ca-certificates + FROM busybox:glibc -COPY --from=builder /go/'"$thispkg"' /main -COPY --from=builder /go/bin /main +COPY . . + RUN mkdir -p /var/log WORKDIR /main ENV GOPATH="" ENV MNT="/mnt/" -#COPY /etc/ssl/certs /etc/ssl COPY --from=certs /etc/ssl/certs /etc/ssl/certs -ENTRYPOINT ["/main/'"$thisexec"'"] +ENTRYPOINT ["/main/exec-'"$thisexec"'"] CMD [] ' echo "$DOCKERFILE" > "$dockfile"