Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buf-js.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins:
opt:
- import_style=commonjs,binary

# https://github.com/grpc/grpc-node/tree/grpc-tools%401.11.2/packages/grpc-tools/
# https://github.com/grpc/grpc-node/tree/grpc-tools%401.12.4/packages/grpc-tools/
- name: grpc
out: gen/proto/js
opt: grpc_js
Expand Down
51 changes: 2 additions & 49 deletions build.assets/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
# teleport built on any newer Ubuntu version will not run on Centos 7 because
# of this.

# GRPC_NODE_PLUGIN_BINARY_TYPE has to be defined above the first FROM as it's
# used in another FROM instruction. See the comment for grpc_node_plugin image
# for more details.
# Valid values are "prebuilt" and "compiled".
ARG GRPC_NODE_PLUGIN_BINARY_TYPE

## LIBFIDO2 ###################################################################

# Build libfido2 separately for isolation, speed and flexibility.
Expand Down Expand Up @@ -72,33 +66,6 @@ RUN mkdir -p /opt && cd /opt && curl -L https://github.com/gravitational/libbpf/
make && \
make install

## GRPC_NODE_PLUGIN ###########################################################

# grpc_node_plugin is built only on arm64.
#
# To generate JS protofiles, we need the grpc-tools npm package. Unfortunately,
# it doesn't ship with a prebuilt grpc_node_plugin binary for Linux arm64. [1]
#
# We have to build it from source. Cloning all submodules takes a lot of time
# and bandwith so we build the binary in a separate image.
#
# [1] https://github.com/grpc/grpc-node/issues/1405#issuecomment-1282201879

FROM buildpack-deps:18.04 AS grpc_node_plugin
RUN apt-get update && \
apt-get install -y --no-install-recommends cmake
COPY teleterm_linux_arm64.toolchain.cmake ./linux_arm64.toolchain.cmake
RUN git clone --depth=1 --branch=grpc-tools@1.11.2 https://github.com/grpc/grpc-node.git && \
mv linux_arm64.toolchain.cmake grpc-node/packages/grpc-tools/. && \
cd grpc-node && \
git submodule update --init --recursive && \
cd packages/grpc-tools && \
cmake -DCMAKE_TOOLCHAIN_FILE=linux_arm64.toolchain.cmake . && \
cmake --build . --target clean && cmake --build . --target grpc_node_plugin -- -j 12 && \
mv grpc_node_plugin ../../../. && \
cd ../../.. && \
rm -rf grpc-node

## BUILDBOX ###################################################################
#
# Image layers are ordered according to how slow that layer takes to build and
Expand Down Expand Up @@ -269,8 +236,8 @@ RUN helm plugin install https://github.com/vbehar/helm3-unittest && \
chown -R ci /home/ci/.local/share/helm && \
HELM_PLUGINS=/home/ci/.local/share/helm/plugins helm plugin list

# Install JS gRPC tools
RUN (npm install --global grpc_tools_node_protoc_ts@5.0.1)
# Install JS gRPC tools.
RUN (npm install --global grpc_tools_node_protoc_ts@5.0.1 grpc-tools@1.12.4)

# Install protobuf and grpc build tools.
ARG PROTOC_VER
Expand Down Expand Up @@ -329,19 +296,5 @@ RUN cd /usr/local/lib && \
ldconfig
COPY pkgconfig/buildbox/ /

FROM buildbox AS grpc_node_plugin_binary_prebuilt
ONBUILD RUN (npm install --global grpc-tools@1.11.2)

FROM buildbox AS grpc_node_plugin_binary_compiled
COPY --from=grpc_node_plugin grpc_node_plugin ./grpc_node_plugin
ONBUILD RUN npm install --global --ignore-scripts grpc-tools@1.11.2 && \
mv grpc_node_plugin $(npm root -g)/grpc-tools/bin/. && \
# grpc-tools needs protoc but we already install it a couple of steps above.
ln -s $(which protoc) $(npm root -g)/grpc-tools/bin/protoc

# A "conditional" FROM like this breaks up the number of steps in the progress bar of the given
# image, so let's use it at the end. This way the progress bar for buildbox stays mostly untouched.
FROM grpc_node_plugin_binary_${GRPC_NODE_PLUGIN_BINARY_TYPE} as buildbox

VOLUME ["/go/src/github.com/gravitational/teleport"]
EXPOSE 6600 2379 2380
8 changes: 0 additions & 8 deletions build.assets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ endif
DOCKERFLAGS := $(DOCKERFLAGS) -v $(GOCACHE):/go/cache -e GOCACHE=/go/cache
endif

ifeq ("$(RUNTIME_ARCH)","arm64")
GRPC_NODE_PLUGIN_BINARY_TYPE := compiled
else
GRPC_NODE_PLUGIN_BINARY_TYPE := prebuilt
endif
export


#
# Build 'teleport' release inside a docker container
Expand Down Expand Up @@ -133,7 +126,6 @@ buildbox:
--build-arg GOLANG_VERSION=$(GOLANG_VERSION) \
--build-arg RUST_VERSION=$(RUST_VERSION) \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg GRPC_NODE_PLUGIN_BINARY_TYPE=$(GRPC_NODE_PLUGIN_BINARY_TYPE) \
--build-arg PROTOC_VER=$(PROTOC_VER) \
--build-arg GOGO_PROTO_TAG=$(GOGO_PROTO_TAG) \
--build-arg LIBBPF_VERSION=$(LIBBPF_VERSION) \
Expand Down
4 changes: 0 additions & 4 deletions build.assets/teleterm_linux_arm64.toolchain.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion web/packages/teleterm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build-renderer": "webpack build --config webpack.renderer.prod.config.js --progress",
"build-native-deps": "electron-builder install-app-deps",
"package": "electron-builder build --config electron-builder-config.js --publish never -c.extraMetadata.name=teleport-connect",
"generate-grpc-shared": "npx -y --target_arch=x64 --package=grpc_tools_node_protoc_ts@5.3.2 --package=grpc-tools@1.11.2 -- grpc_tools_node_protoc -I=src/sharedProcess/api/proto --ts_out=service=grpc-node,mode=grpc-js:src/sharedProcess/api/protogen --grpc_out=grpc_js:src/sharedProcess/api/protogen --js_out=import_style=commonjs,binary:src/sharedProcess/api/protogen src/sharedProcess/api/proto/*.proto"
"generate-grpc-shared": "npx -y --target_arch=x64 --package=grpc_tools_node_protoc_ts@5.3.2 --package=grpc-tools@1.12.4 -- grpc_tools_node_protoc -I=src/sharedProcess/api/proto --ts_out=service=grpc-node,mode=grpc-js:src/sharedProcess/api/protogen --grpc_out=grpc_js:src/sharedProcess/api/protogen --js_out=import_style=commonjs,binary:src/sharedProcess/api/protogen src/sharedProcess/api/proto/*.proto"
},
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(ravicious): Before introducing any changes, move this file to the /proto dir and
// remove the generate-grpc-shared script.

syntax = "proto3";

import "google/protobuf/struct.proto";
Expand Down