-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiarch (linux/amd64,linux/arm64) support
- Loading branch information
Showing
4 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
FROM rubensa/ubuntu-tini-dev | ||
LABEL author="Ruben Suarez <[email protected]>" | ||
|
||
# Architecture component of TARGETPLATFORM (platform of the build result) | ||
ARG TARGETARCH | ||
|
||
# If defined, install specified NVIDIA driver version | ||
ARG NVIDIA_VERSION | ||
|
||
|
@@ -41,14 +44,14 @@ RUN echo "# Configuring '${USER_NAME}' for X11 functionallity..." \ | |
&& usermod -a -G video ${USER_NAME} | ||
|
||
# Install NVIDIA drivers in the image if NVIDIA_VERSION arg set | ||
RUN if [ ! -z ${NVIDIA_VERSION} ] ; \ | ||
then \ | ||
echo "# Downloading NVIDIA drivers matching host version (${NVIDIA_VERSION})..."; \ | ||
curl -sSLO http://us.download.nvidia.com/XFree86/Linux-x86_64/${NVIDIA_VERSION}/NVIDIA-Linux-x86_64-${NVIDIA_VERSION}.run; \ | ||
chmod +x NVIDIA-Linux-x86_64-${NVIDIA_VERSION}.run; \ | ||
echo "# Installing NVIDIA drivers..."; \ | ||
./NVIDIA-Linux-x86_64-${NVIDIA_VERSION}.run --ui=none --no-kernel-module --no-install-compat32-libs --install-libglvnd --no-questions; \ | ||
rm NVIDIA-Linux-x86_64-${NVIDIA_VERSION}.run; \ | ||
RUN if [ ! -z ${NVIDIA_VERSION} ] ; then \ | ||
if [ "$TARGETARCH" = "arm64" ]; then TARGET=aarch64; elif [ "$TARGETARCH" = "amd64" ]; then TARGET=x86_64; else TARGET=$TARGETARCH; fi; \ | ||
echo "# Downloading NVIDIA drivers matching host version (${NVIDIA_VERSION})..."; \ | ||
curl -sSLO http://us.download.nvidia.com/XFree86/Linux-${TARGET}/${NVIDIA_VERSION}/NVIDIA-Linux-${TARGET}-${NVIDIA_VERSION}.run; \ | ||
chmod +x NVIDIA-Linux-${TARGET}-${NVIDIA_VERSION}.run; \ | ||
echo "# Installing NVIDIA drivers..."; \ | ||
./NVIDIA-Linux-${TARGET}-${NVIDIA_VERSION}.run --ui=none --no-kernel-module --no-install-compat32-libs --install-libglvnd --no-questions; \ | ||
rm NVIDIA-Linux-${TARGET}-${NVIDIA_VERSION}.run; \ | ||
fi | ||
|
||
# Add script to allow nvidia drivers installation on user interactive session | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,14 @@ You can build the image like this: | |
``` | ||
#!/usr/bin/env bash | ||
docker build --no-cache \ | ||
docker buildx build --platform=linux/amd64,linux/arm64 --no-cache \ | ||
-t "rubensa/ubuntu-tini-x11" \ | ||
--label "maintainer=Ruben Suarez <[email protected]>" \ | ||
. | ||
docker buildx build --load \ | ||
-t "rubensa/ubuntu-tini-x11" \ | ||
. | ||
``` | ||
|
||
To make an Nvidia GPU available in the docker container, the following steps have to be taken: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker build --no-cache \ | ||
docker buildx build --platform=linux/amd64,linux/arm64 --no-cache \ | ||
-t "rubensa/ubuntu-tini-x11" \ | ||
--label "maintainer=Ruben Suarez <[email protected]>" \ | ||
. | ||
|
||
docker buildx build --load \ | ||
-t "rubensa/ubuntu-tini-x11" \ | ||
. |