hack: update proto generators for arm64

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
v0.9
Tonis Tiigi 2021-06-06 22:35:42 -07:00
parent 8e88c5d270
commit 33af267b9a
2 changed files with 21 additions and 3 deletions

View File

@ -8,7 +8,11 @@ ARG GOGO_VERSION=v1.3.2
RUN apt-get update && apt-get --no-install-recommends install -y \
unzip \
&& true
RUN wget -q https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local
ARG TARGETOS TARGETARCH
RUN set -e; \
arch=$(echo $TARGETARCH | sed -e s/amd64/x86_64/ -e s/arm64/aarch_64/); \
wget -q https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${TARGETOS}-${arch}.zip && unzip protoc-${PROTOC_VERSION}-${TARGETOS}-${arch}.zip -d /usr/local
RUN git clone https://github.com/gogo/protobuf.git /go/src/github.com/gogo/protobuf \
&& cd /go/src/github.com/gogo/protobuf \
@ -33,7 +37,7 @@ RUN mkdir /generated-files
RUN --mount=target=/tmp/src \
cp -r /tmp/src/. . && \
git add -A && \
go generate ./... && \
go generate -mod=vendor -v ./... && \
git ls-files -m --others -- **/*.pb.go | tar -cf - --files-from - | tar -C /generated-files -xf -
FROM scratch AS update
@ -42,4 +46,4 @@ COPY --from=generated /generated-files /generated-files
FROM gobuild-base AS validate
RUN --mount=target=/tmp/src \
cp -r /tmp/src/. . && \
go generate ./... && git diff && ./hack/validate-generated-files check
go generate -mod=vendor -v ./... && git diff && ./hack/validate-generated-files check

14
hack/shell_backup Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
function clean() {
docker rmi $(cat $iidfile)
}
iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX)
DOCKER_BUILDKIT=1 docker build --iidfile $iidfile --target dev-env .
#DOCKER_BUILDKIT=1 docker build --iidfile $iidfile -f ./hack/dockerfiles/test.buildkit.Dockerfile --target dev-env .
trap clean EXIT
SSH=
if [ -n "$MOUNT_SSH_AUTH_SOCK" ]; then
SSH="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK"
fi
docker run $SSH -it --privileged -v /tmp --net=host --rm -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry $(cat $iidfile)