Skip to content

Commit

Permalink
Use Target Architecture Argument for docker build
Browse files Browse the repository at this point in the history
In the spanner emulator, a version of wrench is downloaded. But it is hardcoded to amd64.

This change uses the auto populated TARGETARCH argument.

Now, we know which architecture to use when downloading the wrench CLI. Should fix the problem for those running the repo on a Macbook.

See: #720 (comment)
  • Loading branch information
jcscottiii committed Oct 4, 2024
1 parent 857cb18 commit 520291b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .dev/spanner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
# limitations under the License.

FROM google/cloud-sdk:494.0.0-emulators
# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
# https://docs.docker.com/reference/dockerfile/#automatic-platform-args-in-the-global-scope
ARG TARGETARCH

ENV SPANNER_PROJECT_ID=local
ENV SPANNER_INSTANCE_ID=local
ENV SPANNER_DATABASE_ID=local
ENV SPANNER_EMULATOR_HOST=0.0.0.0:9010

# Install Wrench - https://github.com/cloudspannerecosystem/wrench
ENV WRENCH_VERSION="1.7.0"
ENV WRENCH_VERSION="1.10.1"
RUN echo "Downloading for version ${WRENCH_VERSION} for architecture ${TARGETARCH}"
RUN curl \
-L -o wrench.tar.gz \
"https://github.com/cloudspannerecosystem/wrench/releases/download/v${WRENCH_VERSION}/wrench-${WRENCH_VERSION}-linux-amd64.tar.gz" && \
"https://github.com/cloudspannerecosystem/wrench/releases/download/v${WRENCH_VERSION}/wrench-${WRENCH_VERSION}-linux-${TARGETARCH}.tar.gz" && \
tar -xf wrench.tar.gz && mv wrench /bin/

RUN gcloud config set auth/disable_credentials true && \
Expand Down

0 comments on commit 520291b

Please sign in to comment.