2024-08-25 02:39:48 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
2024-02-04 01:57:14 +00:00
|
|
|
# artifacts: false
|
|
|
|
# platforms: linux/amd64
|
|
|
|
# platforms_pr: linux/amd64
|
|
|
|
# no-cache-filters: toolchain-base,toolchain
|
|
|
|
ARG BASE=ubuntu
|
|
|
|
ARG TAG=22.04
|
|
|
|
FROM ${BASE}:${TAG} AS toolchain-base
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2024-08-25 02:39:48 +00:00
|
|
|
FROM toolchain-base AS toolchain
|
2024-02-04 01:57:14 +00:00
|
|
|
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
RUN echo "target_platform: ${TARGETPLATFORM}"
|
|
|
|
|
2024-03-24 23:52:24 +00:00
|
|
|
ENV DISPLAY=:0
|
|
|
|
|
2024-02-04 01:57:14 +00:00
|
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
2024-08-25 02:39:48 +00:00
|
|
|
|
2024-02-04 01:57:14 +00:00
|
|
|
# install dependencies
|
2024-08-25 02:39:48 +00:00
|
|
|
# hadolint ignore=SC1091
|
2024-02-04 01:57:14 +00:00
|
|
|
RUN <<_DEPS
|
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
apt-get update -y
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
build-essential \
|
|
|
|
cmake=3.22.* \
|
|
|
|
ca-certificates \
|
2024-03-24 23:52:24 +00:00
|
|
|
doxygen \
|
2024-02-04 01:57:14 +00:00
|
|
|
gcc=4:11.2.* \
|
|
|
|
g++=4:11.2.* \
|
|
|
|
gdb \
|
|
|
|
git \
|
2024-03-24 23:52:24 +00:00
|
|
|
graphviz \
|
2024-02-04 01:57:14 +00:00
|
|
|
libayatana-appindicator3-dev \
|
|
|
|
libcap-dev \
|
|
|
|
libcurl4-openssl-dev \
|
|
|
|
libdrm-dev \
|
|
|
|
libevdev-dev \
|
|
|
|
libminiupnpc-dev \
|
|
|
|
libnotify-dev \
|
|
|
|
libnuma-dev \
|
|
|
|
libopus-dev \
|
|
|
|
libpulse-dev \
|
|
|
|
libssl-dev \
|
|
|
|
libva-dev \
|
|
|
|
libwayland-dev \
|
|
|
|
libx11-dev \
|
|
|
|
libxcb-shm0-dev \
|
|
|
|
libxcb-xfixes0-dev \
|
|
|
|
libxcb1-dev \
|
|
|
|
libxfixes-dev \
|
|
|
|
libxrandr-dev \
|
|
|
|
libxtst-dev \
|
|
|
|
udev \
|
2024-03-24 23:52:24 +00:00
|
|
|
wget \
|
|
|
|
x11-xserver-utils \
|
|
|
|
xvfb
|
2024-02-04 01:57:14 +00:00
|
|
|
apt-get clean
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2024-08-25 02:39:48 +00:00
|
|
|
# Install Node
|
|
|
|
wget --max-redirect=0 -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
|
2024-02-04 01:57:14 +00:00
|
|
|
source "$HOME/.nvm/nvm.sh"
|
2024-08-25 02:39:48 +00:00
|
|
|
nvm install node
|
|
|
|
nvm use node
|
|
|
|
nvm alias default node
|
|
|
|
_DEPS
|
2024-02-04 01:57:14 +00:00
|
|
|
|
|
|
|
# install cuda
|
|
|
|
WORKDIR /build/cuda
|
|
|
|
# versions: https://developer.nvidia.com/cuda-toolkit-archive
|
|
|
|
ENV CUDA_VERSION="11.8.0"
|
|
|
|
ENV CUDA_BUILD="520.61.05"
|
|
|
|
# hadolint ignore=SC3010
|
|
|
|
RUN <<_INSTALL_CUDA
|
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
|
|
|
|
cuda_suffix=""
|
|
|
|
if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
|
|
|
|
cuda_suffix="_sbsa"
|
|
|
|
fi
|
|
|
|
url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
|
|
|
|
echo "cuda url: ${url}"
|
|
|
|
wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run
|
|
|
|
chmod a+x ./cuda.run
|
|
|
|
./cuda.run --silent --toolkit --toolkitpath=/usr/local --no-opengl-libs --no-man-page --no-drm
|
|
|
|
rm ./cuda.run
|
|
|
|
_INSTALL_CUDA
|
2024-03-24 23:52:24 +00:00
|
|
|
|
|
|
|
WORKDIR /
|
|
|
|
# Write a shell script that starts Xvfb and then runs a shell
|
|
|
|
RUN <<_ENTRYPOINT
|
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cat <<EOF > /entrypoint.sh
|
|
|
|
#!/bin/bash
|
|
|
|
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
|
|
|
if [ "\$#" -eq 0 ]; then
|
|
|
|
exec "/bin/bash"
|
|
|
|
else
|
|
|
|
exec "\$@"
|
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Make the script executable
|
2024-08-25 02:39:48 +00:00
|
|
|
chmod +x /entrypoint.sh
|
2024-03-24 23:52:24 +00:00
|
|
|
|
|
|
|
# Note about CLion
|
2024-08-25 02:39:48 +00:00
|
|
|
echo "ATTENTION: CLion will override the entrypoint, you can disable this in the toolchain settings"
|
|
|
|
_ENTRYPOINT
|
2024-03-24 23:52:24 +00:00
|
|
|
|
|
|
|
# Use the shell script as the entrypoint
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|