diff --git a/.changeset/funny-paws-admire.md b/.changeset/funny-paws-admire.md new file mode 100644 index 0000000000..6cba8148f8 --- /dev/null +++ b/.changeset/funny-paws-admire.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/services": patch +--- + +The build phase of services now works on machines with older protobuf compilers diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..b3d04a3155 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +node_modules +**/node_modules +.gitignore +*.md +dist +**/dist +**/out/ +**/cache/ +**/bindings/ +**/artifacts/ +**/abi/ +**/broadcast/ +**/deploys/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..6acdf3cd85 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM docker.io/library/debian:bullseye-slim as base +ENV SHELL /bin/bash + +WORKDIR /opt +RUN apt-get -y update --fix-missing && \ + apt-get -y upgrade && \ + apt-get install -y --no-install-recommends \ + libssl-dev make cmake graphviz \ + git pkg-config curl time rhash ca-certificates jq \ + python3 python3-pip lsof ruby ruby-bundler git-restore-mtime xz-utils zstd unzip gnupg protobuf-compiler \ + wget net-tools iptables iproute2 iputils-ping ed zlib1g-dev wabt && \ + curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ + apt-get install -y nodejs + +# foundry +RUN curl -L https://foundry.paradigm.xyz/ | bash && \ + ${HOME}/.foundry/bin/foundryup \ + && forge --version \ + && cast --version \ + && anvil --version \ + && chisel --version +# go +RUN wget https://dl.google.com/go/go1.20.4.linux-amd64.tar.gz && \ + # -C to move to given directory + tar -C /usr/local/ -xzf go1.20.4.linux-amd64.tar.gz +# pnpm +RUN npm install pnpm --global && pnpm --version + +FROM base AS builder +COPY . /app +WORKDIR /app + +ENV PATH="${PATH}:/usr/local/go/bin" +ENV PATH="${PATH}:/root/.foundry/bin" +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile +RUN pnpm run -r build + +FROM builder AS store-indexer +WORKDIR /app/packages/store-indexer +EXPOSE 3001 \ No newline at end of file diff --git a/packages/services/Makefile b/packages/services/Makefile index 989dcdba22..945a2318bf 100644 --- a/packages/services/Makefile +++ b/packages/services/Makefile @@ -29,27 +29,32 @@ protoc-ts: --plugin protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto \ --ts_proto_out ./protobuf/ts/ecs-stream \ --ts_proto_opt=env=browser,outputServices=nice-grpc,outputServices=generic-definitions,outputJsonMethods=false,useExactTypes=false,eslint_disable,esModuleInterop=true,importSuffix=.js \ - --proto_path proto proto/ecs-stream.proto + --proto_path proto proto/ecs-stream.proto \ + --experimental_allow_proto3_optional protoc \ --plugin protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto \ --ts_proto_out ./protobuf/ts/ecs-snapshot \ --ts_proto_opt=env=browser,outputServices=nice-grpc,outputServices=generic-definitions,outputJsonMethods=false,useExactTypes=false,eslint_disable,esModuleInterop=true,importSuffix=.js \ - --proto_path proto proto/ecs-snapshot.proto + --proto_path proto proto/ecs-snapshot.proto \ + --experimental_allow_proto3_optional protoc \ --plugin protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto \ --ts_proto_out ./protobuf/ts/ecs-relay \ --ts_proto_opt=env=browser,outputServices=nice-grpc,outputServices=generic-definitions,outputJsonMethods=false,useExactTypes=false,eslint_disable,esModuleInterop=true,importSuffix=.js \ - --proto_path proto proto/ecs-relay.proto + --proto_path proto proto/ecs-relay.proto \ + --experimental_allow_proto3_optional protoc \ --plugin protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto \ --ts_proto_out ./protobuf/ts/faucet \ --ts_proto_opt=env=browser,outputServices=nice-grpc,outputServices=generic-definitions,outputJsonMethods=false,useExactTypes=false,eslint_disable,esModuleInterop=true,importSuffix=.js \ - --proto_path proto proto/faucet.proto + --proto_path proto proto/faucet.proto \ + --experimental_allow_proto3_optional protoc \ --plugin protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto \ --ts_proto_out ./protobuf/ts/mode \ --ts_proto_opt=env=browser,outputServices=nice-grpc,outputServices=generic-definitions,outputJsonMethods=false,useExactTypes=false,eslint_disable,esModuleInterop=true,importSuffix=.js \ - --proto_path proto proto/mode.proto + --proto_path proto proto/mode.proto \ + --experimental_allow_proto3_optional .PHONY: protoc-ts protoc-clean: