build: use pre-built binary in Dockerfile

GoReleaser copies the compiled binary into the Docker context.
Dockerfile should COPY the binary, not rebuild from source.
This commit is contained in:
2026-03-01 20:51:33 -08:00
parent 20bad6d881
commit aea66656ee
+1 -10
View File
@@ -1,14 +1,5 @@
FROM golang:1.26-alpine AS builder
ARG TARGETARCH
RUN apk add --no-cache git make
WORKDIR /src
COPY go.mod go.sum ./
COPY vendor/ vendor/
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH:-amd64} go build -mod=vendor -o /mpcd ./cmd/mpcd/
FROM alpine:3.20
RUN apk add --no-cache ca-certificates
COPY --from=builder /mpcd /usr/local/bin/mpcd
COPY mpcd /usr/local/bin/mpcd
EXPOSE 8081
ENTRYPOINT ["mpcd"]