mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 01:39:34 +08:00
Add GPU-enabled build target in dockerfile_Agent (nvidia-smi support) (#898)
This commit is contained in:
17
.github/workflows/docker-images.yml
vendored
17
.github/workflows/docker-images.yml
vendored
@@ -21,6 +21,14 @@ jobs:
|
|||||||
- image: henrygd/beszel-agent
|
- image: henrygd/beszel-agent
|
||||||
context: ./beszel
|
context: ./beszel
|
||||||
dockerfile: ./beszel/dockerfile_Agent
|
dockerfile: ./beszel/dockerfile_Agent
|
||||||
|
target: default-agent
|
||||||
|
registry: docker.io
|
||||||
|
username_secret: DOCKERHUB_USERNAME
|
||||||
|
password_secret: DOCKERHUB_TOKEN
|
||||||
|
- image: henrygd/beszel-agent-nvidia
|
||||||
|
context: ./beszel
|
||||||
|
dockerfile: ./beszel/dockerfile_Agent
|
||||||
|
target: nvidia-agent
|
||||||
registry: docker.io
|
registry: docker.io
|
||||||
username_secret: DOCKERHUB_USERNAME
|
username_secret: DOCKERHUB_USERNAME
|
||||||
password_secret: DOCKERHUB_TOKEN
|
password_secret: DOCKERHUB_TOKEN
|
||||||
@@ -33,6 +41,14 @@ jobs:
|
|||||||
- image: ghcr.io/${{ github.repository }}/beszel-agent
|
- image: ghcr.io/${{ github.repository }}/beszel-agent
|
||||||
context: ./beszel
|
context: ./beszel
|
||||||
dockerfile: ./beszel/dockerfile_Agent
|
dockerfile: ./beszel/dockerfile_Agent
|
||||||
|
target: default-agent
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password_secret: GITHUB_TOKEN
|
||||||
|
- image: ghcr.io/${{ github.repository }}/beszel-agent-nvidia
|
||||||
|
context: ./beszel
|
||||||
|
dockerfile: ./beszel/dockerfile_Agent
|
||||||
|
target: nvidia-agent
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password_secret: GITHUB_TOKEN
|
password_secret: GITHUB_TOKEN
|
||||||
@@ -91,3 +107,4 @@ jobs:
|
|||||||
push: ${{ github.ref_type == 'tag' }}
|
push: ${{ github.ref_type == 'tag' }}
|
||||||
tags: ${{ steps.metadata.outputs.tags }}
|
tags: ${{ steps.metadata.outputs.tags }}
|
||||||
labels: ${{ steps.metadata.outputs.labels }}
|
labels: ${{ steps.metadata.outputs.labels }}
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
@@ -14,13 +14,21 @@ RUN CGO_ENABLED=0 GOGC=75 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-
|
|||||||
|
|
||||||
RUN rm -rf /tmp/*
|
RUN rm -rf /tmp/*
|
||||||
|
|
||||||
# ? -------------------------
|
# --------------------------
|
||||||
FROM scratch
|
# Final image: default scratch-based agent
|
||||||
|
# --------------------------
|
||||||
|
FROM scratch AS default-agent
|
||||||
COPY --from=builder /agent /agent
|
COPY --from=builder /agent /agent
|
||||||
|
|
||||||
# this is so we don't need to create the
|
# this is so we don't need to create the /tmp directory in the scratch container
|
||||||
# /tmp directory in the scratch container
|
|
||||||
COPY --from=builder /tmp /tmp
|
COPY --from=builder /tmp /tmp
|
||||||
|
|
||||||
ENTRYPOINT ["/agent"]
|
ENTRYPOINT ["/agent"]
|
||||||
|
|
||||||
|
# --------------------------
|
||||||
|
# Final image: GPU-enabled agent with nvidia-smi
|
||||||
|
# --------------------------
|
||||||
|
FROM nvidia/cuda:12.9.0-base-ubuntu22.04 AS nvidia-agent
|
||||||
|
COPY --from=builder /agent /agent
|
||||||
|
COPY --from=builder /tmp /tmp
|
||||||
|
ENTRYPOINT ["/agent"]
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
services:
|
services:
|
||||||
beszel-agent:
|
beszel-agent:
|
||||||
image: 'henrygd/beszel-agent'
|
image: 'henrygd/beszel-agent' #Or henrygd/beszel-agent-nvidia
|
||||||
container_name: 'beszel-agent'
|
container_name: 'beszel-agent'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
network_mode: host
|
network_mode: host
|
||||||
|
# Only when using henrygd/beszel-agent-nvidia
|
||||||
|
# runtime: nvidia
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
# monitor other disks / partitions by mounting a folder in /extra-filesystems
|
# monitor other disks / partitions by mounting a folder in /extra-filesystems
|
||||||
@@ -11,3 +13,6 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
PORT: 45876
|
PORT: 45876
|
||||||
KEY: 'ssh-ed25519 YOUR_PUBLIC_KEY'
|
KEY: 'ssh-ed25519 YOUR_PUBLIC_KEY'
|
||||||
|
# Only when using henrygd/beszel-agent-nvidia
|
||||||
|
# NVIDIA_VISIBLE_DEVICES: all
|
||||||
|
# NVIDIA_DRIVER_CAPABILITIES: compute,video,utility
|
||||||
|
@@ -11,13 +11,16 @@ services:
|
|||||||
- 'host.docker.internal:host-gateway'
|
- 'host.docker.internal:host-gateway'
|
||||||
|
|
||||||
beszel-agent:
|
beszel-agent:
|
||||||
image: 'henrygd/beszel-agent'
|
image: 'henrygd/beszel-agent' #Add -nvidia for nvidia gpus
|
||||||
container_name: 'beszel-agent'
|
container_name: 'beszel-agent'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
network_mode: host
|
network_mode: host
|
||||||
|
# runtime: nvidia # when using beszel-agent-nvidia
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
environment:
|
environment:
|
||||||
PORT: 45876
|
PORT: 45876
|
||||||
KEY: '...'
|
KEY: '...'
|
||||||
# FILESYSTEM: /dev/sda1 # set to the correct filesystem for disk I/O stats
|
# FILESYSTEM: /dev/sda1 # set to the correct filesystem for disk I/O stats
|
||||||
|
# NVIDIA_VISIBLE_DEVICES: all # when using beszel-agent-nvidia
|
||||||
|
# NVIDIA_DRIVER_CAPABILITIES: utility # when using beszel-agent-nvidia
|
||||||
|
Reference in New Issue
Block a user