mirror of
https://github.com/fankes/beszel.git
synced 2025-10-18 17:29:28 +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
|
||||
context: ./beszel
|
||||
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
|
||||
username_secret: DOCKERHUB_USERNAME
|
||||
password_secret: DOCKERHUB_TOKEN
|
||||
@@ -33,6 +41,14 @@ jobs:
|
||||
- image: ghcr.io/${{ github.repository }}/beszel-agent
|
||||
context: ./beszel
|
||||
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
|
||||
username: ${{ github.actor }}
|
||||
password_secret: GITHUB_TOKEN
|
||||
@@ -91,3 +107,4 @@ jobs:
|
||||
push: ${{ github.ref_type == 'tag' }}
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
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/*
|
||||
|
||||
# ? -------------------------
|
||||
FROM scratch
|
||||
|
||||
# --------------------------
|
||||
# Final image: default scratch-based agent
|
||||
# --------------------------
|
||||
FROM scratch AS default-agent
|
||||
COPY --from=builder /agent /agent
|
||||
|
||||
# this is so we don't need to create the
|
||||
# /tmp directory in the scratch container
|
||||
# this is so we don't need to create the /tmp directory in the scratch container
|
||||
COPY --from=builder /tmp /tmp
|
||||
|
||||
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:
|
||||
beszel-agent:
|
||||
image: 'henrygd/beszel-agent'
|
||||
image: 'henrygd/beszel-agent' #Or henrygd/beszel-agent-nvidia
|
||||
container_name: 'beszel-agent'
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
# Only when using henrygd/beszel-agent-nvidia
|
||||
# runtime: nvidia
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
# monitor other disks / partitions by mounting a folder in /extra-filesystems
|
||||
@@ -11,3 +13,6 @@ services:
|
||||
environment:
|
||||
PORT: 45876
|
||||
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'
|
||||
|
||||
beszel-agent:
|
||||
image: 'henrygd/beszel-agent'
|
||||
image: 'henrygd/beszel-agent' #Add -nvidia for nvidia gpus
|
||||
container_name: 'beszel-agent'
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
# runtime: nvidia # when using beszel-agent-nvidia
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
environment:
|
||||
PORT: 45876
|
||||
KEY: '...'
|
||||
# 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