forked from MauriceNino/dashdot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.nvidia
97 lines (82 loc) · 2.56 KB
/
Dockerfile.nvidia
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
# 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", "."]