Skip to content

Commit 7cf5625

Browse files
authored
fix: Add M1/ARM support for the test suite (#516)
* Add M1/ARM support for the test suite * Merge ARM/x86 Dockerfiles
1 parent bf4139b commit 7cf5625

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

aliases.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ PROJECT_ROOT=$(realpath $(dirname "$BASH_SOURCE"))
33
PROJECT_ROOT_DOCKER="//ts-proto" # double slash to support git bash on windows
44

55
# Alias docker-compose to make it usable from anywhere.
6-
function _docker-compose() { docker-compose -f $PROJECT_ROOT/docker-compose.yml "$@"; }
6+
function _docker-compose() {
7+
if [ uname -a | grep arm64 ]
8+
then
9+
ARCH=aarch_64
10+
fi
11+
docker-compose -f $PROJECT_ROOT/docker-compose.yml "$@";
12+
}
713

814
# Dockerized version of protoc.
915
function protoc() { _docker-compose run --rm -w //host --entrypoint protoc -- protoc "$@"; }

docker-compose.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ services:
44
build:
55
context: .
66
dockerfile: "protoc.Dockerfile"
7+
args:
8+
- "ARCH=${ARCH:-x86_64}"
79
volumes:
810
- ".:/ts-proto"
911
- "${PWD:-.}:/host"

protoc.Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Docker image for protoc
22
FROM node:17-alpine3.14
33
ARG PROTOC_VERSION="3.19.1"
4+
ARG ARCH="x86_64"
45

56
RUN apk add bash
67
RUN apk add gcompat
7-
ADD "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip" protoc.zip
8+
ADD "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-$ARCH.zip" protoc.zip
89
RUN mkdir /usr/local/lib/protoc && unzip protoc.zip -d /usr/local/lib/protoc && rm protoc.zip
910
RUN ln -s /usr/local/lib/protoc/bin/protoc /usr/local/bin/protoc
1011

0 commit comments

Comments
 (0)