openark / orchestrator

MySQL replication topology management and HA
Apache License 2.0
5.62k stars 927 forks source link

Docker build fails - go binary not found #1398

Open d-rupp opened 3 years ago

d-rupp commented 3 years ago

Hello!

I tried updating to 3.2.6 from 3.2.5 and encountered this issue while not changing anything else.

Building from the Dockerfile fails because it can not find the go binary.

STEP 1: FROM golang:1.16.6-alpine3.14 AS build
STEP 2: ENV GOPATH=/tmp/go
STEP 3: RUN apk --no-cache add libcurl rsync gcc g++ build-base bash git
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/34) Installing ncurses-terminfo-base (6.2_p20210612-r0)
(2/34) Installing ncurses-libs (6.2_p20210612-r0)
(3/34) Installing readline (8.1.0-r0)
(4/34) Installing bash (5.1.4-r0)
Executing bash-5.1.4-r0.post-install
(5/34) Installing libgcc (10.3.1_git20210424-r2)
(6/34) Installing libstdc++ (10.3.1_git20210424-r2)
(7/34) Installing binutils (2.35.2-r2)
(8/34) Installing libmagic (5.40-r1)
(9/34) Installing file (5.40-r1)
(10/34) Installing libgomp (10.3.1_git20210424-r2)
(11/34) Installing libatomic (10.3.1_git20210424-r2)
(12/34) Installing libgphobos (10.3.1_git20210424-r2)
(13/34) Installing gmp (6.2.1-r0)
(14/34) Installing isl22 (0.22-r0)
(15/34) Installing mpfr4 (4.1.0-r0)
(16/34) Installing mpc1 (1.2.1-r0)
(17/34) Installing gcc (10.3.1_git20210424-r2)
(18/34) Installing musl-dev (1.2.2-r3)
(19/34) Installing libc-dev (0.7.2-r3)
(20/34) Installing g++ (10.3.1_git20210424-r2)
(21/34) Installing make (4.3-r0)
(22/34) Installing fortify-headers (1.1-r1)
(23/34) Installing patch (2.7.6-r7)
(24/34) Installing build-base (0.5-r2)
(25/34) Installing brotli-libs (1.0.9-r5)
(26/34) Installing nghttp2-libs (1.43.0-r0)
(27/34) Installing libcurl (7.78.0-r0)
(28/34) Installing expat (2.4.1-r0)
(29/34) Installing pcre2 (10.36-r0)
(30/34) Installing git (2.32.0-r0)
(31/34) Installing libacl (2.2.53-r0)
(32/34) Installing popt (1.18-r0)
(33/34) Installing zstd-libs (1.4.9-r1)
(34/34) Installing rsync (3.2.3-r4)
Executing busybox-1.33.1-r2.trigger
OK: 213 MiB in 49 packages
STEP 4: RUN mkdir -p $GOPATH/src/github.com/openark/orchestrator
STEP 5: WORKDIR $GOPATH/src/github.com/openark/orchestrator
STEP 6: COPY . .
STEP 7: RUN bash build.sh -b -P
[DEBUG] Build only; no packaging
[DEBUG] Creating build paths
go binary not found in PATH
error building at STEP "RUN bash build.sh -b -P": error while running runtime: exit status 1
d-rupp commented 3 years ago

Had a chance to look at this in more detail.

If i remove lines 82-85 from build.sh it builds just fine. But i can´t figure out why the test fails. Tried to reproduce it in the golang image itself and it works fine for me.

Removed this:

  if [[ ! -x "$( which go )" ]]; then
    echo "go binary not found in PATH"
    ok=1
  fi

Testing (with golang:1.16.6-alpine3.14 image):

[root@orchestrator1.dev orchestrator]$ docker exec -it gotest /bin/sh
/go # which go
/usr/local/go/bin/go
/go # ls -al $( which go )
-rwxr-xr-x    1 root     root      14072854 Jul 13 00:44 /usr/local/go/bin/go
/go # [[ ! -x "$( which go )" ]] && echo "yep"
/go # [[ -x "$( which go )" ]] && echo "yep"
yep