fix: multi-stage Dockerfile, remove prebuilt — Go 1.26, alpine 3.21, GOPRIVATE for private deps

This commit is contained in:
2025-12-27 21:34:54 -08:00
parent cf954b7d36
commit d12d984eaf
2 changed files with 19 additions and 10 deletions
+19 -3
View File
@@ -1,5 +1,21 @@
FROM alpine:3.20
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
RUN apk add --no-cache git ca-certificates
ARG GITHUB_TOKEN
RUN git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
ENV GOPRIVATE=github.com/luxfi/*,github.com/hanzoai/*
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o mpcd ./cmd/mpcd
FROM alpine:3.21
RUN apk add --no-cache ca-certificates
COPY mpcd /usr/local/bin/mpcd
EXPOSE 8081
COPY --from=builder /app/mpcd /usr/local/bin/mpcd
EXPOSE 8081 9651 9800
ENTRYPOINT ["mpcd"]
-7
View File
@@ -1,7 +0,0 @@
FROM alpine:3.20
ARG TARGETARCH
RUN apk add --no-cache ca-certificates
COPY mpcd-linux-${TARGETARCH} /usr/local/bin/mpcd
RUN chmod +x /usr/local/bin/mpcd
EXPOSE 8081 9651 9800
ENTRYPOINT ["mpcd"]