hopefully

master
Bel LaPointe 2018-11-11 09:27:49 -07:00
parent 94737c4807
commit 94b257ad4d
1 changed files with 4 additions and 3 deletions

7
do.sh
View File

@ -4,6 +4,7 @@ function main() {
set -e set -e
set -u set -u
thispkg="${PWD##*$GOPATH/}" thispkg="${PWD##*$GOPATH/}"
thisexec="$(basename "$thispkg")"
function cleanup() { function cleanup() {
rm "$compile" rm "$compile"
rm "$dockfile" rm "$dockfile"
@ -148,7 +149,7 @@ set -u
go get -d ./... go get -d ./...
CGO_ENABLED=0 go build -o /go/bin/exec -a -installsuffix cgo CGO_ENABLED=0 go build -o /go/bin/'"$thisexec"' -a -installsuffix cgo
' > "$compile" ' > "$compile"
from="golang:1.10-alpine" from="golang:1.10-alpine"
@ -172,15 +173,15 @@ RUN apk update && apk add ca-certificates
#======================== #========================
FROM busybox:glibc FROM busybox:glibc
COPY --from=builder /go/bin /main
COPY --from=builder /go/'"$thispkg"' /main COPY --from=builder /go/'"$thispkg"' /main
COPY --from=builder /go/bin /main
RUN mkdir -p /var/log RUN mkdir -p /var/log
WORKDIR /main WORKDIR /main
ENV GOPATH="" ENV GOPATH=""
ENV MNT="/mnt/" ENV MNT="/mnt/"
#COPY /etc/ssl/certs /etc/ssl #COPY /etc/ssl/certs /etc/ssl
COPY --from=certs /etc/ssl/certs /etc/ssl/certs COPY --from=certs /etc/ssl/certs /etc/ssl/certs
ENTRYPOINT ["/main/exec"] ENTRYPOINT ["/main/'"$thisexec"'"]
' '
echo "$DOCKERFILE" > "$dockfile" echo "$DOCKERFILE" > "$dockfile"
} }