-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove grpc-teleterm Make target and Dockerfile-teleterm #20032
Changes from 7 commits
f925132
66ead80
6cd6c08
545a3e9
d983f38
57b80af
c5cfbf6
42a45e1
ed19a28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,11 @@ | |
# teleport built on any newer Ubuntu version will not run on Centos 7 because | ||
# of this. | ||
|
||
ARG RUST_VERSION | ||
# 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 ################################################################### | ||
|
||
|
@@ -68,6 +72,33 @@ 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 ################################################################### | ||
|
||
FROM ubuntu:18.04 AS buildbox | ||
|
@@ -122,6 +153,8 @@ RUN apt-get -y update && \ | |
python3-setuptools \ | ||
python3-wheel \ | ||
pkg-config \ | ||
# Used during tag builds to build the RPM package of Connect. | ||
rpm \ | ||
softhsm2 \ | ||
sudo \ | ||
tree \ | ||
|
@@ -236,16 +269,16 @@ RUN make -C /opt/pam_teleport install | |
|
||
ENV SOFTHSM2_PATH "/usr/lib/softhsm/libsofthsm2.so" | ||
|
||
# Install Nodejs | ||
# Install Node.js | ||
ARG NODE_VERSION | ||
ENV NODE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${BUILDARCH}.tar.xz" | ||
ENV NODE_PATH="/usr/local/lib/nodejs-linux" | ||
ENV PATH="$PATH:${NODE_PATH}/bin" | ||
RUN export NODE_ARCH=$(if [ "$BUILDARCH" = "amd64" ]; then echo "x64"; else echo "arm64"; fi) && \ | ||
export NODE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" && \ | ||
mkdir -p ${NODE_PATH} && \ | ||
curl -o /tmp/nodejs.tar.xz -L ${NODE_URL} && \ | ||
tar -xJf /tmp/nodejs.tar.xz -C /usr/local/lib/nodejs-linux --strip-components=1 | ||
export NODE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" && \ | ||
mkdir -p ${NODE_PATH} && \ | ||
curl -o /tmp/nodejs.tar.xz -L ${NODE_URL} && \ | ||
tar -xJf /tmp/nodejs.tar.xz -C /usr/local/lib/nodejs-linux --strip-components=1 | ||
RUN corepack enable yarn | ||
|
||
# Install Rust | ||
|
@@ -279,7 +312,7 @@ COPY --from=libbpf /usr/lib64/ /usr/lib64/ | |
RUN cd /usr/local/lib && ldconfig | ||
|
||
# Copy libfido2 libraries. | ||
# Do this last to take better advantage of the multi-stage build. | ||
# Do this near the end to take better advantage of the multi-stage build. | ||
COPY --from=libfido2 /usr/local/include/ /usr/local/include/ | ||
COPY --from=libfido2 /usr/local/lib/pkgconfig/ /usr/local/lib/pkgconfig/ | ||
COPY --from=libfido2 \ | ||
|
@@ -294,5 +327,22 @@ RUN cd /usr/local/lib && \ | |
ldconfig | ||
COPY pkgconfig/buildbox/ / | ||
|
||
# Install JS gRPC tools | ||
RUN (npm install --global grpc_tools_node_protoc_ts@5.0.1) | ||
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This conditional FROM is based on this SO answer: https://stackoverflow.com/a/60820156/742872 |
||
|
||
VOLUME ["/go/src/github.com/gravitational/teleport"] | ||
EXPOSE 6600 2379 2380 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,8 @@ main() { | |
# <teleport-root>/github.com/gravitational/teleport/..., so we copy them to | ||
# the correct relative path. | ||
trap 'rm -fr github.com' EXIT # don't leave github.com/ behind | ||
rm -fr api/gen/proto gen/proto # cleanup gen/proto folders | ||
# cleanup gen/proto folders | ||
rm -fr api/gen/proto gen/proto lib/teleterm/api/protogen lib/prehog/gen lib/prehog/gen-js | ||
|
||
# Generate Gogo protos. | ||
buf generate --template=buf-gogo.gen.yaml api/proto | ||
|
@@ -26,6 +27,14 @@ main() { | |
--path=proto/teleport/lib/multiplexer/ | ||
buf generate --template=lib/prehog/buf.gen.yaml lib/prehog/proto | ||
|
||
# Generate lib/teleterm & JS protos. | ||
# TODO(ravicious): Refactor generating JS protos to follow the approach from above, that is have a | ||
# separate call to generate Go protos and another for JS protos instead of having | ||
# teleterm-specific buf.gen.yaml files. | ||
# https://github.com/gravitational/teleport/pull/19774#discussion_r1061524458 | ||
buf generate --template=lib/prehog/buf-teleterm.gen.yaml lib/prehog/proto | ||
buf generate --template=lib/teleterm/buf.gen.yaml lib/teleterm/api/proto | ||
Comment on lines
+30
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Originally I wanted to do this in this PR. But the list of changes is already big enough so I'll handle that in a separate PR (which I'm working on at the moment). |
||
|
||
cp -r github.com/gravitational/teleport/* . | ||
} | ||
|
||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RUST_VERSION
was defined twice in Dockerfile.