Maint: use curly braces around BUILDPLATFORM

This commit is contained in:
Quentin McGaw (desktop)
2021-07-20 15:27:16 +00:00
parent da4d528463
commit cb0e89a38e

View File

@@ -5,10 +5,10 @@ ARG XCPUTRANSLATE_VERSION=v0.6.0
ARG GOLANGCI_LINT_VERSION=v1.41.1 ARG GOLANGCI_LINT_VERSION=v1.41.1
ARG BUILDPLATFORM=linux/amd64 ARG BUILDPLATFORM=linux/amd64
FROM --platform=$BUILDPLATFORM qmcgaw/xcputranslate:${XCPUTRANSLATE_VERSION} AS xcputranslate FROM --platform=${BUILDPLATFORM} qmcgaw/xcputranslate:${XCPUTRANSLATE_VERSION} AS xcputranslate
FROM --platform=${BUILDPLATFORM} qmcgaw/binpot:golangci-lint-${GOLANGCI_LINT_VERSION} AS golangci-lint FROM --platform=${BUILDPLATFORM} qmcgaw/binpot:golangci-lint-${GOLANGCI_LINT_VERSION} AS golangci-lint
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${GO_ALPINE_VERSION} AS base FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine${GO_ALPINE_VERSION} AS base
COPY --from=xcputranslate /xcputranslate /usr/local/bin/xcputranslate COPY --from=xcputranslate /xcputranslate /usr/local/bin/xcputranslate
RUN apk --update add git g++ RUN apk --update add git g++
ENV CGO_ENABLED=0 ENV CGO_ENABLED=0
@@ -19,18 +19,18 @@ RUN go mod download
COPY cmd/ ./cmd/ COPY cmd/ ./cmd/
COPY internal/ ./internal/ COPY internal/ ./internal/
FROM --platform=$BUILDPLATFORM base AS test FROM --platform=${BUILDPLATFORM} base AS test
# Note on the go race detector: # Note on the go race detector:
# - we set CGO_ENABLED=1 to have it enabled # - we set CGO_ENABLED=1 to have it enabled
# - we installed g++ to support the race detector # - we installed g++ to support the race detector
ENV CGO_ENABLED=1 ENV CGO_ENABLED=1
ENTRYPOINT go test -race -coverpkg=./... -coverprofile=coverage.txt -covermode=atomic ./... ENTRYPOINT go test -race -coverpkg=./... -coverprofile=coverage.txt -covermode=atomic ./...
FROM --platform=$BUILDPLATFORM base AS lint FROM --platform=${BUILDPLATFORM} base AS lint
COPY .golangci.yml ./ COPY .golangci.yml ./
RUN golangci-lint run --timeout=10m RUN golangci-lint run --timeout=10m
FROM --platform=$BUILDPLATFORM base AS tidy FROM --platform=${BUILDPLATFORM} base AS tidy
RUN git init && \ RUN git init && \
git config user.email ci@localhost && \ git config user.email ci@localhost && \
git config user.name ci && \ git config user.name ci && \
@@ -39,7 +39,7 @@ RUN git init && \
go mod tidy && \ go mod tidy && \
git diff --exit-code -- go.mod git diff --exit-code -- go.mod
FROM --platform=$BUILDPLATFORM base AS build FROM --platform=${BUILDPLATFORM} base AS build
ARG TARGETPLATFORM ARG TARGETPLATFORM
ARG ALLTARGETPLATFORMS=${TARGETPLATFORM} ARG ALLTARGETPLATFORMS=${TARGETPLATFORM}
ARG VERSION=unknown ARG VERSION=unknown