FROM --platform=$BUILDPLATFORM golang:1.25 AS build-stage ARG TARGETPLATFORM ARG BUILDPLATFORM RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" WORKDIR /app COPY go.mod ./ RUN go mod download COPY . ./ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /plexbrainz # Run the tests in the container FROM build-stage AS run-test-stage RUN go test -v ./... # Deploy the application binary into a lean image FROM gcr.io/distroless/base-debian11 AS build-release-stage WORKDIR / COPY --from=build-stage /plexbrainz /plexbrainz EXPOSE 1973 USER nonroot:nonroot ENTRYPOINT ["/plexbrainz"]