Skip to content

Commit 0d13e50

Browse files
committed
Formal docker images for conftest
The makefile is required as goreleaser is fairly limited about what it can do with images. The examples images should make demos easier, as it includes all of the required tools to run the existing set of demos.
1 parent 8ca4397 commit 0d13e50

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

Dockerfile

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,36 @@ WORKDIR /
44
COPY . /
55
RUN go build .
66

7+
78
FROM bats/bats:v1.1.0 as acceptance
89
COPY --from=builder /conftest /usr/local/bin
910
COPY acceptance.bats /acceptance.bats
10-
COPY testdata /testdata
11+
COPY examples /examples
1112
RUN ./acceptance.bats
13+
14+
15+
FROM golang:1.12-alpine as examples
16+
17+
ENV TERRAFORM_VERSION=0.12.0-rc1 \
18+
KUSTOMIZE_VERSION=2.0.3
19+
20+
COPY --from=builder /conftest /usr/local/bin
21+
COPY examples /examples
22+
23+
RUN apk add --update npm make git jq ca-certificates openssl unzip wget && \
24+
cd /tmp && \
25+
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
26+
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin
27+
28+
RUN wget -O /usr/local/bin/kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64 && \
29+
chmod +x /usr/local/bin/kustomize
30+
31+
RUN go get -u cuelang.org/go/cmd/cue
32+
33+
WORKDIR /examples
34+
35+
36+
FROM scratch
37+
COPY --from=builder /conftest /
38+
ENTRYPOINT ["/conftest"]
39+
CMD ["--help"]

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
TAG=$(shell git describe --abbrev=0 --tags)
3+
4+
NAME=conftest
5+
IMAGE=instrumenta/$(NAME)
6+
7+
COMMAND=docker
8+
BUILD=DOCKER_BUILDKIT=1 $(COMMAND) build
9+
PUSH=$(COMMAND) push
10+
11+
all: push
12+
13+
examples:
14+
$(BUILD) --target examples -t instrumenta/conftest:examples .
15+
16+
acceptance:
17+
$(BUILD) --target acceptance .
18+
19+
conftest:
20+
$(BUILD) -t $(IMAGE):$(TAG) .
21+
$(COMMAND) tag $(IMAGE):$(TAG) $(IMAGE):latest
22+
23+
push: example conftest
24+
$(PUSH) $(IMAGE):$(TAG)
25+
$(PUSH) $(IMAGE):latest
26+
$(PUSH) $(IMAGE):examples
27+
28+
.PHONY: examples acceptance conftest push all

0 commit comments

Comments
 (0)