Skip to content

Instantly share code, notes, and snippets.

@keeth
Created April 5, 2023 16:48
Show Gist options
  • Save keeth/cf537eb3421bd73a3184a604d287aa6a to your computer and use it in GitHub Desktop.
Save keeth/cf537eb3421bd73a3184a604d287aa6a to your computer and use it in GitHub Desktop.
Multi-arch BigTable emulator docker image
#!/bin/bash
port=8086
cmd=/google-cloud-sdk/bin/gcloud
$cmd components update beta
$cmd beta emulators bigtable start --quiet --host-port=0.0.0.0:$port &
while true; do
nc -z -v -w1 localhost $port >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Process is listening on port $port."
break
else
echo "Waiting for process to listen on port $port..."
fi
sleep 1
done
echo "BigTable emulator installed"
kill %1
FROM python:3-slim
COPY build.sh /build.sh
RUN apt-get update -qqy && apt-get install -qqy curl netcat &&\
curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-424.0.0-linux-arm.tar.gz -o google-cloud-cli.tar.gz &&\
tar -xf google-cloud-cli.tar.gz &&\
rm google-cloud-cli.tar.gz &&\
/google-cloud-sdk/install.sh --quiet --usage-reporting=false --screen-reader=false --command-completion=false --path-update=false &&\
/build.sh &&\
apt-get clean
CMD /google-cloud-sdk/bin/gcloud beta emulators bigtable start --quiet --host-port=0.0.0.0:8086
EXPOSE 8086
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment