Skip to content

Commit

Permalink
chore(internal/gapicgen): fix dockerfile build (#7455)
Browse files Browse the repository at this point in the history
With the release of 1.20 golang no longer ships a bunch of stuff pre-compiled, see: https://tip.golang.org/doc/go1.20

This seems to mean non-glibc distros like alpine are harder to use Go with. From what I am seeing you basically need to build from source. That is a decent number of steps to get all the deps right so lets copy the go binary from the offical image for now. Was getting the error: Error loading shared library libresolv.so.2
  • Loading branch information
codyoss authored Feb 17, 2023
1 parent f9ff2ca commit cf85910
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/gapicgen/cmd/genbot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
FROM golang:1.20-alpine as godist
RUN go version

FROM docker:20.10

# Log the version of Alpine in use.
Expand All @@ -18,10 +21,8 @@ RUN apk add libc6-compat
RUN apk add protoc protobuf-dev
RUN protoc --version

# Install Go...quietly.
RUN wget -O /tmp/go.tgz https://dl.google.com/go/go1.20.linux-amd64.tar.gz -q && \
tar -C /usr/local -xzf /tmp/go.tgz && \
rm /tmp/go.tgz
# Copy pre-built alpine Go
COPY --from=godist /usr/local/go /usr/local/go
ENV PATH /usr/local/go/bin:$PATH
RUN go version

Expand Down

0 comments on commit cf85910

Please sign in to comment.