Build go without a container to avoid vendor
parent
429bc20133
commit
c8f015930e
37
do.sh
37
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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue