Skip to content
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

Move Connect build to a new Docker container #27175

Merged
merged 4 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 0 additions & 4 deletions build.assets/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# This Dockerfile makes the "build box" the container used to:
# * build Teleport Connect
# * run test and linters in CI
# * building other Docker images
#
# For Teleport releases we're using CentOS 7 box to keep the binaries compatible
# with older Linux distributions (glibc 2.17+).
#
# This image uses Ubuntu 20.04 as a base as Connect links against glibc and
# we want to keep the required version as low as possible.
#
# Check the README to learn how to safely introduce changes to Dockerfiles.

## LIBFIDO2 ###################################################################
Expand Down
47 changes: 47 additions & 0 deletions build.assets/Dockerfile-connect
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This Dockerfile makes the "build box connect" the container used
# to build the Teleport Connect.
#
# This image is base on the node image, which is based on Debian.
# Using it as a image allows us to link agains the same version of
# glibc as Node.js.
#
# Check the README to learn how to safely introduce changes to Dockerfiles.

## BUILDBOX-CONNECT ###################################################################

ARG NODE_VERSION
FROM node:${NODE_VERSION} AS buildbox

COPY locale.gen /etc/locale.gen
COPY profile /etc/profile
ENV LANGUAGE="en_US.UTF-8" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
LC_CTYPE="en_US.UTF-8" \
DEBIAN_FRONTEND="noninteractive"

# Install packages.
RUN apt-get -y update && \
apt-get -y install software-properties-common && \
codingllama marked this conversation as resolved.
Show resolved Hide resolved
apt-get install -q -y --no-install-recommends \
apt-utils \
build-essential \
ca-certificates \
git \
libc6-dev \
libssl-dev \
locales \
openssh-client \
python3-pip \
python3-setuptools \
python3-wheel \
pkg-config \
codingllama marked this conversation as resolved.
Show resolved Hide resolved
# Used during tag builds to build the RPM package of Connect.
rpm \
&& \
dpkg-reconfigure locales && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*

# Do not create the ci user as we do on other images, as node image
# already has node user with UID:GID 1000:1000 user.
21 changes: 19 additions & 2 deletions build.assets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,29 @@ ifeq ($(CONNECT_VERSION),)
CONNECT_VERSION := $(BUILDBOX_VERSION)-dev
endif

#
# Builds a Docker buildbox for Linux Connect builds
#
.PHONY:buildbox-connect
buildbox-connect:
if [[ $${DRONE} == "true" ]] && ! docker inspect --type=image $(BUILDBOX_CONNECT) 2>&1 >/dev/null; then docker pull $(BUILDBOX_CONNECT) || true; fi; \
DOCKER_BUILDKIT=1 docker build --platform=linux/$(RUNTIME_ARCH) \
--build-arg UID=$(UID) \
--build-arg GID=$(GID) \
--build-arg BUILDARCH=$(RUNTIME_ARCH) \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg NODE_GRPC_TOOLS_VERSION=$(NODE_GRPC_TOOLS_VERSION) \
--build-arg NODE_PROTOC_TS_VERSION=$(NODE_PROTOC_TS_VERSION) \
--build-arg PROTOC_VER=$(PROTOC_VER) \
codingllama marked this conversation as resolved.
Show resolved Hide resolved
--cache-from $(BUILDBOX_CONNECT) \
--tag $(BUILDBOX_CONNECT) -f Dockerfile-connect . ;

#
# Builds Teleport Connect inside the buildbox container.
#
.PHONY:teleterm
teleterm: buildbox
docker run $(DOCKERFLAGS) $(NOROOT) $(BUILDBOX) \
teleterm: buildbox-connect
docker run $(DOCKERFLAGS) $(NOROOT) $(BUILDBOX_CONNECT) \
bash -c "cd $(SRCDIR) && export CONNECT_TSH_BIN_PATH=\$$PWD/../teleport/build/tsh && yarn install --frozen-lockfile && yarn build-term && yarn package-term -c.extraMetadata.version=$(CONNECT_VERSION)"

# Builds webassets inside Docker.
Expand Down
1 change: 1 addition & 0 deletions build.assets/images.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ BUILDBOX_CENTOS7_FIPS=$(BUILDBOX_BASE_NAME)-centos7-fips:$(BUILDBOX_VERSION)
BUILDBOX_ARM=$(BUILDBOX_BASE_NAME)-arm:$(BUILDBOX_VERSION)
BUILDBOX_ARM_FIPS=$(BUILDBOX_BASE_NAME)-arm-fips:$(BUILDBOX_VERSION)
BUILDBOX_UI=$(BUILDBOX_BASE_NAME)-ui:$(BUILDBOX_VERSION)
BUILDBOX_CONNECT=$(BUILDBOX_BASE_NAME)-connect:$(BUILDBOX_VERSION)
BUILDBOX_CENTOS7_ASSETS=$(BUILDBOX_BASE_NAME)-centos7-assets:$(BUILDBOX_VERSION)

.PHONY:show-buildbox-base-image
Expand Down
Loading