forked from gravitational/teleport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-arm
101 lines (91 loc) · 3.37 KB
/
Dockerfile-arm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# syntax=docker/dockerfile:1
# This Dockerfile is used to build Teleport on ARM (32-bit) only.
# The binaries produced need to be able to run on all the linux
# distributions we support. See https://goteleport.com/docs/installation/
# The binaries also run in the OCI containers we produce,
# both "heavy" and distroless.
#
FROM docker.io/library/debian:11
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 pnpm
# 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
# Install Rust.
ARG RUST_VERSION
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=$RUST_VERSION
RUN mkdir -p $RUSTUP_HOME && chmod a+w $RUSTUP_HOME && \
mkdir -p $CARGO_HOME/registry && chmod -R a+w $CARGO_HOME
# Install Rust using the ci user, as that is the user that
# will run builds using the Rust toolchains we install here.
USER ci
RUN curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain $RUST_VERSION && \
rustup target add arm-unknown-linux-gnueabihf && \
rustup --version && \
cargo --version && \
rustc --version
VOLUME ["/go/src/github.com/gravitational/teleport"]