Skip to content

Commit

Permalink
build: support arm64 architecture (#768)
Browse files Browse the repository at this point in the history
Signed-off-by: fsl <[email protected]>

Signed-off-by: fsl <[email protected]>
  • Loading branch information
fengshunli authored Jan 15, 2023
1 parent 3b6c625 commit 2aec436
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
FROM golang:1.19.4-alpine as base
ARG ARCH=amd64
ARG TARGETARCH
ARG VERSION
ARG COMMIT
ARG DATE
ENV GOOS=linux \
CGO_ENABLED=0 \
GOARCH=${ARCH}
RUN apk add --no-cache git
WORKDIR /app

Expand All @@ -17,7 +14,7 @@ COPY . .

## BUILDER STAGE ##
FROM base as builder
RUN go build -o conftest -ldflags="-w -s -X github.com/open-policy-agent/conftest/internal/commands.version=${VERSION}" main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o conftest -ldflags="-w -s -X github.com/open-policy-agent/conftest/internal/commands.version=${VERSION}" main.go

## TEST STAGE ##
FROM base as test
Expand All @@ -42,18 +39,18 @@ COPY examples /examples

WORKDIR /tmp
RUN apk add --no-cache npm make git jq ca-certificates openssl unzip wget && \
wget "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" && \
wget "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${TARGETARCH}.zip" && \
unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -d /usr/local/bin

RUN wget -O /usr/local/bin/kustomize "https://github.com/kubernetes-sigs/kustomize/releases/download/v${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64" && \
RUN wget -O /usr/local/bin/kustomize "https://github.com/kubernetes-sigs/kustomize/releases/download/v${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_${TARGETARCH}" && \
chmod +x /usr/local/bin/kustomize

RUN go install cuelang.org/go/cmd/cue@latest

WORKDIR /examples

## RELEASE ##
FROM alpine:3.17.0
FROM alpine:3.17.1

# Install git for protocols that depend on it when using conftest pull
RUN apk add --no-cache git
Expand Down

0 comments on commit 2aec436

Please sign in to comment.