-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd0f736
commit 6a4f280
Showing
4 changed files
with
156 additions
and
0 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 |
---|---|---|
|
@@ -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: | ||
|
@@ -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 | ||
|
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,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"] |
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