teleport/build.assets/Dockerfile-arm
Reed Loden b8feb63de7
Update distroless images to use Debian 12 (#31620)
https://github.com/GoogleContainerTools/distroless#debian-12

Note that the debian12 images no longer include OpenSSL, which we
don't need anyway, as we statically link our own copy for tsh and
other purposes.

Also, add Debian 12 to various places, as a supported OS.

Other included changes:
* Remove Debian 8 and 9, as they aren't receiving any security updates.
* Standardize how we select which distroless release to use.
* Ensure a specific distroless version is used instead of latest.
* Add new Amazon Linux and Oracle Linux releases to compatibility testing.
* Correct s/MacOS/macOS/ in install script.

`e` companion -- https://github.com/gravitational/teleport.e/pull/2154
2023-09-13 18:56:02 +00:00

81 lines
2.7 KiB
Plaintext

# This Dockerfile is used to build Teleport on ARM only.
# We are using the official Debian 12 image as a base image
# because the final binary must be compatible with distroless
# images that are also Debian 12 based: https://github.com/GoogleContainerTools/distroless
FROM docker.io/library/debian:12
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"
# BUILDARCH is automatically set by DOCKER when building the image with Build Kit (MacOS by default).
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG BUILDARCH
RUN apt-get -y update && \
apt-get install -q -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
gzip \
libc6-dev \
libpam-dev \
locales \
pkg-config \
sudo \
unzip \
zip \
# ARM dependencies
gcc-arm-linux-gnueabihf \
libc6-dev-armhf-cross \
# ARM64 dependencies
gcc-aarch64-linux-gnu \
libc6-dev-arm64-cross \
&& \
dpkg-reconfigure locales && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*
# Install Node.js.
ARG NODE_VERSION
ENV NODE_PATH="/usr/local/lib/nodejs-linux"
ENV PATH="$PATH:${NODE_PATH}/bin"
RUN NODE_ARCH="$(if [ "$BUILDARCH" = 'amd64' ]; then echo 'x64'; else echo 'arm64'; fi)" && \
NODE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" && \
NODE_FILE="$(mktemp node-XXXXXX.tar.xz)" && \
mkdir -p "$NODE_PATH" && \
curl -o "$NODE_FILE" -fsSL "$NODE_URL" && \
tar -xJf "$NODE_FILE" -C /usr/local/lib/nodejs-linux --strip-components=1 && \
rm -f "$NODE_FILE"
RUN corepack enable yarn
# Install Go.
ARG GOLANG_VERSION
RUN mkdir -p /opt && \
cd /opt && \
curl -fsSL "https://storage.googleapis.com/golang/$GOLANG_VERSION.linux-$BUILDARCH.tar.gz" | tar xz && \
mkdir -p /go/src/github.com/gravitational/teleport && \
chmod a+w /go && \
chmod a+w /var/lib && \
chmod a-w /
ENV GOPATH="/go" \
GOROOT="/opt/go" \
PATH="$PATH:/opt/go/bin:/go/bin:/go/src/github.com/gravitational/teleport/build"
# Add the CI user.
# This images is not used in CI, but because we used to use it in CI, we keep the same UID/GID and name.
ARG UID
ARG GID
RUN groupadd ci --gid="$GID" -o && \
useradd ci --uid="$UID" --gid="$GID" --create-home --shell=/bin/sh && \
mkdir -p -m0700 /var/lib/teleport && \
chown -R ci /var/lib/teleport
VOLUME ["/go/src/github.com/gravitational/teleport"]