Files
localmodelroutex/Dockerfile

27 lines
1.0 KiB
Docker

# syntax=docker/dockerfile:1
# ── Build stages run on the build host (amd64); Go cross-compiles for TARGETARCH.
# This avoids QEMU emulation and cuts arm64 build time from ~15min to ~2min.
FROM --platform=$BUILDPLATFORM node:22-alpine AS ui
WORKDIR /src/dashboard
COPY backend/dashboard/package*.json ./
RUN npm ci
COPY backend/dashboard/ ./
RUN npm run build
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS go-build
ARG TARGETARCH
ENV GOTOOLCHAIN=auto CGO_ENABLED=0 GOARCH=$TARGETARCH
WORKDIR /src
COPY backend/go.mod backend/go.sum ./
RUN go mod download
COPY backend/ .
COPY --from=ui /src/dashboard/../internal/web/dist ./internal/web/dist
RUN go build -trimpath -ldflags="-s -w" -o /lmr ./cmd/server
# ── Runtime stage ─────────────────────────────────────────────────────────────
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=go-build /lmr /lmr
EXPOSE 8080
ENTRYPOINT ["/lmr"]