Files
llama-swap/Build.Containerfile
Andreas b984f5ca08
Some checks failed
Linux CI / run-tests (push) Has been cancelled
Windows CI / run-tests (push) Has been cancelled
Close inactive issues / close-issues (push) Successful in -1m29s
Build Containers / build-and-push (cpu) (push) Failing after -1m27s
Build Containers / build-and-push (cuda) (push) Failing after -1m28s
Build Containers / build-and-push (intel) (push) Failing after -1m28s
Build Containers / build-and-push (musa) (push) Failing after -1m28s
Build Containers / build-and-push (vulkan) (push) Failing after -1m28s
Build Containers / delete-untagged-containers (push) Has been skipped
Containerized build and socket activation docs
2025-11-20 00:18:58 +01:00

61 lines
1.2 KiB
Docker

# Stage 1: Build UI with Node.js
FROM node:25.2.1-trixie-slim AS ui-builder
WORKDIR /app
# Copy UI source
COPY ui/package*.json ./
RUN npm install -g typescript && npm ci --only=production
RUN npm install --save-dev @types/react @types/react-dom
# Build UI
COPY ui/ ./
RUN npm run build
# Stage 2: Build Go binary with embedded UI
FROM golang:1.25.4 AS go-builder
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy all source code
COPY . .
# Copy UI build artifacts to embed directory
#COPY --from=ui-builder /app/build ./ui/build
COPY --from=ui-builder /proxy/ui_dist ./proxy/ui_dist
# Build the binary (Linux AMD64)
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags="-X main.commit=$(git rev-parse --short HEAD) -X main.version=local_$(git rev-parse --short HEAD) -X main.date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
-o build/llama-swap
FROM ghcr.io/ggml-org/llama.cpp:full-vulkan
# has to be after the FROM
ARG LS_VER=170
# Add user/group
ENV HOME=/app
WORKDIR /app
# Copy the binary from builder stage
COPY --from=go-builder /app/build/llama-swap .
COPY ./docker/config.example.yaml /config.yaml
ENTRYPOINT [ "/app/llama-swap", "-config", "/config.yaml" ]