-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add separate image for nvidia gpu support (#1010)
fixes #290 Co-authored-by: HoreaM <horea_manita@yahoo.com>
- Loading branch information
1 parent
bf88696
commit 319120d
Showing
10 changed files
with
219 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,5 @@ | |
.dockerignore | ||
Dockerfile | ||
Dockerfile.dev | ||
Dockerfile.nvidia | ||
docker-compose.yml |
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
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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# BASE # | ||
FROM nvidia/cuda:12.2.0-base-ubuntu20.04 AS base | ||
|
||
WORKDIR /app | ||
ARG TARGETPLATFORM | ||
ENV DASHDOT_IMAGE=nvidia | ||
ENV DASHDOT_RUNNING_IN_DOCKER=true | ||
ENV NVIDIA_VISIBLE_DEVICES=all | ||
ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" | ||
|
||
RUN \ | ||
/bin/echo ">> installing dependencies" &&\ | ||
apt-get update &&\ | ||
apt-get install -y \ | ||
curl \ | ||
wget \ | ||
mdadm \ | ||
dmidecode \ | ||
util-linux \ | ||
pciutils \ | ||
lm-sensors \ | ||
speedtest-cli &&\ | ||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&\ | ||
apt-get install -y nodejs &&\ | ||
corepack enable &&\ | ||
if [ "$TARGETPLATFORM" = "linux/amd64" ] || [ "$(uname -m)" = "x86_64" ]; \ | ||
then \ | ||
/bin/echo ">> installing dependencies (amd64)" &&\ | ||
wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-x86_64.tgz \ | ||
| tar xmoz -C /usr/bin speedtest; \ | ||
elif [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$(uname -m)" = "aarch64" ]; \ | ||
then \ | ||
/bin/echo ">> installing dependencies (arm64)" &&\ | ||
wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-aarch64.tgz \ | ||
| tar xmoz -C /usr/bin speedtest; \ | ||
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; \ | ||
then \ | ||
/bin/echo ">> installing dependencies (arm/v7)" &&\ | ||
wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-armhf.tgz \ | ||
| tar xmoz -C /usr/bin speedtest; \ | ||
else /bin/echo "Unsupported platform"; exit 1; \ | ||
fi &&\ | ||
/bin/echo -e ">> clean-up" &&\ | ||
apt-get clean && \ | ||
rm -rf /tmp/* /var/tmp/* | ||
|
||
# DEV # | ||
FROM base AS dev | ||
|
||
EXPOSE 3001 | ||
EXPOSE 3000 | ||
|
||
RUN \ | ||
/bin/echo -e ">> installing dependencies (dev)" &&\ | ||
apt-get install -y \ | ||
git &&\ | ||
git config --global --add safe.directory /app | ||
|
||
# BUILD # | ||
FROM base as build | ||
|
||
ARG BUILDHASH | ||
ARG VERSION | ||
|
||
RUN \ | ||
/bin/echo -e ">> installing dependencies (build)" &&\ | ||
apt-get install -y \ | ||
git \ | ||
make \ | ||
clang \ | ||
build-essential &&\ | ||
git config --global --add safe.directory /app &&\ | ||
/bin/echo -e "{\"version\":\"$VERSION\",\"buildhash\":\"$BUILDHASH\"}" > /app/version.json | ||
|
||
COPY . ./ | ||
|
||
RUN \ | ||
yarn --immutable --immutable-cache &&\ | ||
yarn build:prod &&\ | ||
node scripts/strip_package_json.js | ||
|
||
# PROD # | ||
FROM base as prod | ||
|
||
EXPOSE 3001 | ||
|
||
COPY --from=build /app/version.json . | ||
COPY --from=build /app/.yarn/releases .yarn/releases | ||
COPY --from=build /app/.yarnrc.yml .yarnrc.yml | ||
COPY --from=build /app/dist/apps/server dist/apps/server | ||
COPY --from=build /app/dist/apps/cli dist/apps/cli | ||
COPY --from=build /app/dist/apps/view dist/apps/view | ||
COPY --from=build /app/dist/package.json package.json | ||
|
||
RUN yarn | ||
|
||
CMD ["node", "."] |
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
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
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const packageJson = require('../package.json') | ||
const fs = require('fs') | ||
|
||
const newPackageJson = { | ||
name: packageJson.name, | ||
version: packageJson.version, | ||
description: packageJson.description, | ||
packageManager: packageJson.packageManager, | ||
main: packageJson.main, | ||
scripts: { | ||
cli: 'node dist/apps/cli/main.js', | ||
} | ||
} | ||
|
||
fs.writeFileSync('dist/package.json', JSON.stringify(newPackageJson, null, 2)) |