Skip to content

Commit eefca6e

Browse files
committed
Enable GPU if available in Makefile
Also some podman-compatibility fixes, trying to compare why GPU access works in podman and not docker and vice versa for debugging reasons. Signed-off-by: Eric Curtin <eric.curtin@docker.com>
1 parent 3886d0f commit eefca6e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
ARG GO_VERSION=1.24.2
44
ARG LLAMA_SERVER_VERSION=latest
55
ARG LLAMA_SERVER_VARIANT=cpu
6+
ARG TARGETARCH=${BUILDARCH}
67
ARG LLAMA_BINARY_PATH=/com.docker.llama-server.native.linux.${LLAMA_SERVER_VARIANT}.${TARGETARCH}
78
ARG BASE_IMAGE=ubuntu:24.04
89

9-
FROM golang:${GO_VERSION}-bookworm AS builder
10+
FROM docker.io/library/golang:${GO_VERSION}-bookworm AS builder
1011

1112
# Install git for go mod download if needed
1213
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
@@ -33,7 +34,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
3334
FROM docker/docker-model-backend-llamacpp:${LLAMA_SERVER_VERSION}-${LLAMA_SERVER_VARIANT} AS llama-server
3435

3536
# --- Final image ---
36-
FROM ${BASE_IMAGE} AS final
37+
FROM docker.io/${BASE_IMAGE} AS final
3738

3839
ARG LLAMA_SERVER_VARIANT
3940

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ BASE_IMAGE := ubuntu:24.04
77
DOCKER_IMAGE := docker/model-runner:latest
88
PORT := 8080
99
MODELS_PATH := $(shell pwd)/models-store
10+
GPU_DEVICE_FLAG := $(shell if [ -d /dev/dri ]; then echo "--device /dev/dri"; fi)
1011
LLAMA_ARGS ?=
1112

1213
# Main targets
@@ -61,6 +62,8 @@ docker-run: docker-build
6162
-e DMR_ORIGINS="$(DMR_ORIGINS)" \
6263
-e DO_NOT_TRACK=${DO_NOT_TRACK} \
6364
-e DEBUG=${DEBUG} \
65+
--gpus all \
66+
$(GPU_DEVICE_FLAG) \
6467
$(DOCKER_IMAGE)
6568

6669
# Show help

0 commit comments

Comments
 (0)