Skip to content

Dockerfile improvements, ARM64 binaries #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ builds:
- windows
- linux
- darwin
ignore:
- goarch: 386
goarch:
- amd64
- arm64
ldflags:
- -s -w -X github.com/open-policy-agent/conftest/internal/commands.version={{.Version}} -X github.com/open-policy-agent/conftest/internal/commands.commit={{.ShortCommit}} -X github.com/open-policy-agent/conftest/internal/commands.date={{.Date}}
- "-s"
- "-w"
- "-X github.com/open-policy-agent/conftest/internal/commands.version={{.Version}}"
- "-X github.com/open-policy-agent/conftest/internal/commands.commit={{.ShortCommit}}"
- "-X github.com/open-policy-agent/conftest/internal/commands.date={{.Date}}"
archives:
- replacements:
darwin: Darwin
Expand All @@ -39,7 +44,7 @@ changelog:
- '^docs:'
- '^test:'
brews:
- github:
- tap:
owner: instrumenta
name: homebrew-instrumenta
folder: Formula
Expand Down
21 changes: 12 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM golang:1.13-alpine as base
ENV GOOS=linux CGO_ENABLED=0 GOARCH=amd64
RUN apk --no-cache add git
ARG ARCH=amd64
ENV GOOS=linux \
CGO_ENABLED=0 \
GOARCH=${ARCH}
RUN apk add --no-cache git
WORKDIR /app

COPY go.mod .
Expand All @@ -21,25 +24,25 @@ RUN go test -v ./...
FROM base as acceptance
COPY --from=builder /app/conftest /app/conftest

RUN apk add --update npm bash
RUN apk add --no-cache npm bash
RUN npm install -g bats

RUN bats acceptance.bats

## EXAMPLES STAGE ##
FROM base as examples
ENV TERRAFORM_VERSION=0.12.0-rc1 \
ENV TERRAFORM_VERSION=0.12.28 \
KUSTOMIZE_VERSION=2.0.3

COPY --from=builder /app/conftest /usr/local/bin
COPY examples /examples

RUN apk add --update npm make git jq ca-certificates openssl unzip wget && \
cd /tmp && \
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin
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" && \
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_amd64" && \
chmod +x /usr/local/bin/kustomize

RUN go get -u cuelang.org/go/cmd/cue
Expand Down
6 changes: 3 additions & 3 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Installation

Conftest is available for Windows, macOS and Linux on the [releases page](https://github.com/open-policy-agent/conftest/releases). On Linux and macOS you can download as follows:
Conftest is available for Windows, macOS and Linux on the [releases page](https://github.com/open-policy-agent/conftest/releases). On Linux amd64 and arm64 are supported architectures. On Linux and macOS you can download as follows:

```console
$ wget https://github.com/open-policy-agent/conftest/releases/download/v0.17.1/conftest_0.17.1_Linux_x86_64.tar.gz
$ tar xzf conftest_0.17.1_Linux_x86_64.tar.gz
$ wget https://github.com/open-policy-agent/conftest/releases/download/v0.20.0/conftest_0.20.0_Linux_x86_64.tar.gz
$ tar xzf conftest_0.20.0_Linux_x86_64.tar.gz
$ sudo mv conftest /usr/local/bin
```

Expand Down