Skip to content

Commit

Permalink
feat: add official gpu image
Browse files Browse the repository at this point in the history
  • Loading branch information
MauriceNino committed Jan 19, 2024
1 parent dd0f736 commit 6a4f280
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
sudo rm -f /swapfile
sudo apt clean
df -h
# DEPLOY normal image
- uses: docker/metadata-action@v4
id: meta
with:
Expand Down Expand Up @@ -81,6 +82,41 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
# DEPLOY GPU supported image
- uses: docker/metadata-action@v4
id: meta_gpu
with:
flavor: |
latest=gpu
prefix=gpu-
images: |
ghcr.io/mauricenino/dashdot
mauricenino/dashdot
labels: |
org.opencontainers.image.title="dash."
org.opencontainers.image.description="dash. - a modern server dashboard"
org.opencontainers.image.authors="MauriceNino <[email protected]>"
org.opencontainers.image.url=https://github.com/MauriceNino/dashdot
org.opencontainers.image.source=https://github.com/MauriceNino/dashdot
org.opencontainers.image.licenses=MIT
tags: |
type=semver,pattern={{version}},value=${{ format('v{0}', env.package_version) }},enable=${{ github.ref_name == 'main' }}
type=semver,pattern={{major}}.{{minor}},value=${{ format('v{0}', env.package_version) }},enable=${{ github.ref_name == 'main' }}
type=semver,pattern={{major}},value=${{ format('v{0}', env.package_version) }},enable=${{ github.ref_name == 'main' }}
type=ref,event=branch,enable=${{ github.ref_name != 'main' }}
- uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64/v8
target: prod
push: true
build-args: |
VERSION=${{ github.ref_name == 'main' && env.package_version || format('0.0.0-{0}', github.ref_name) }}
BUILDHASH=${{ github.sha }}
labels: ${{ steps.meta_gpu.outputs.labels }}
tags: ${{ steps.meta_gpu.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
- if: ${{ github.ref_name == 'main' }}
env:
GIT_USER: github-actions
Expand Down
79 changes: 79 additions & 0 deletions Dockerfile.gpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# BASE #
FROM nvidia/cuda:12.2.0-base-ubuntu20.04 AS base

WORKDIR /app
ARG TARGETPLATFORM
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 &&\
npm i -g yarn &&\
wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-x86_64.tgz \
| tar xmoz -C /usr/bin speedtest;

RUN \
/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

# PROD #
FROM base as prod

EXPOSE 3001

COPY --from=build /app/package.json .
COPY --from=build /app/version.json .
COPY --from=build /app/.yarn/releases/ .yarn/releases/
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

CMD ["yarn", "start"]
26 changes: 26 additions & 0 deletions apps/docs/docs/install/docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,29 @@ services:
DASHDOT_ENABLE_CPU_TEMPS: 'true'
# ...
```

## GPU Support

GPU support is available with another image tag and a slightly different config.

> **Note:** GPU support is not available on ARM devices.
```yml
version: '3.5'

services:
dash:
image: mauricenino/dashdot:gpu
restart: unless-stopped
privileged: true
deploy:
resources:
reservations:
devices:
- capabilities:
- gpu
ports:
- '80:3001'
volumes:
- /:/mnt/host:ro
```
15 changes: 15 additions & 0 deletions apps/docs/docs/install/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,18 @@ docker container run -it \
--env DASHDOT_ENABLE_CPU_TEMPS="true" \
# ...
```

## GPU Support

GPU support is available with another image tag and a slightly different command.

> **Note:** GPU support is not available on ARM devices.
```bash
docker container run -it \
-p 80:3001 \
--privileged \
--gpus all \
-v /:/mnt/host:ro \
mauricenino/dashdot:gpu
```

0 comments on commit 6a4f280

Please sign in to comment.