zrhoffman commented on code in PR #7266:
URL: https://github.com/apache/trafficcontrol/pull/7266#discussion_r1063902458


##########
tools/golang/Dockerfile:
##########
@@ -15,24 +15,20 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ARG GO_VERSION
+FROM golang:${GO_VERSION} AS get-go

Review Comment:
   Needs an `alpine-based` golang image since this Dockerfile uses an Alpine 
base image, since musl binaries are a different format



##########
tools/golang/Dockerfile:
##########
@@ -15,24 +15,20 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ARG GO_VERSION
+FROM golang:${GO_VERSION} AS get-go
 FROM alpine:3.13 AS base
 
-COPY GO_VERSION /
+COPY --from=get-go /usr/local/go /usr/local/go
+ENV PATH=/usr/local/go/bin:${PATH} \
+    GOPATH=/go
+
 RUN set -o errexit; \
-    go_version=$(cat /GO_VERSION); \
-    wget -O go.tar.gz 
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz; \
-    tar -C /usr/local -xvzf go.tar.gz; \
-    ln -s /usr/local/go/bin/go /usr/bin/go; \
-    rm go.tar.gz; \
     architecture=$(uname -m); \
     mkdir lib64; \
     # Use musl libc where the go binary expects glibc
     # Less-generalized: ln -s /lib/ld-musl-x86_64.so.1 
/lib64/ld-linux-x86-64.so.2
     ln -s /lib/ld-musl-${architecture}.so.[0-9] 
/lib64/ld-linux-${architecture//_/-}.so.2; \

Review Comment:
   Getting an error building:
   
   ```go
   #12 [golang-unit base 3/4] RUN set -o errexit;     architecture=$(uname -m); 
    mkdir lib64;     ln -s /lib/ld-musl-${architecture}.so.[0-9] 
/lib64/ld-linux-${architecture//_/-}.so.2; RUN apk --no-cache add gcc musl-dev 
git
   #12 1.109 /bin/sh: RUN: not found
   #12 ERROR: executor failed running [/bin/sh -c set -o errexit;     
architecture=$(uname -m);     mkdir lib64;     ln -s 
/lib/ld-musl-${architecture}.so.[0-9] 
/lib64/ld-linux-${architecture//_/-}.so.2; RUN apk --no-cache add gcc musl-dev 
git]: exit code: 127
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to