forked from cyralinc/terraform-provider-cyral
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
21 lines (19 loc) · 807 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
FROM hashicorp/terraform:1.1.8 as terraform
FROM golang:1.17.3-alpine3.13 AS build
WORKDIR /go/src/cyral
RUN apk add --no-cache build-base=0.5-r2
COPY main.go go.mod go.sum ./
COPY client/ client/
COPY cyral/ cyral/
COPY docs/ docs/
COPY scripts/ scripts/
RUN gofmt -w . \
&& go test ./... -race \
&& mkdir -p /out \
&& GOOS=darwin GOARCH=amd64 go build -o out/darwin_amd64/terraform-provider-cyral . \
&& GOOS=linux GOARCH=amd64 go build -o out/linux_amd64/terraform-provider-cyral .
FROM alpine:3.15.4 as output
ARG VERSION
RUN mkdir -p /root/.terraform.d/plugins/local/terraform/cyral/${VERSION:?You must set the VERSION build argument}
COPY --from=build /go/src/cyral/out/ /root/.terraform.d/plugins/local/terraform/cyral/${VERSION}
COPY --from=terraform /bin/terraform /bin/terraform