-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.test
59 lines (42 loc) · 1.67 KB
/
Dockerfile.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ARG TF_VERSION=0.12.24
FROM hashicorp/terraform:$TF_VERSION AS base
RUN apk add --update --no-cache curl tar docker bash
WORKDIR /tmp
# Install kubectl
ARG KUBECTL_VERSION=1.18.1
RUN curl -sLO "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" && \
mv kubectl /usr/bin/kubectl && \
chmod +x /usr/bin/kubectl
# Install kind
ARG KIND_VERSION=0.7.0
RUN curl -sLo kind "https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64" && \
mv kind /usr/bin/kind && \
chmod +x /usr/bin/kind
# terraform provider setup
ARG PROVIDER_VERSION=0.7.6
ARG PROVIDER_NAME="terraform-provider-k8s"
ARG TF_PLUGIN_NAME="${PROVIDER_NAME}_v${PROVIDER_VERSION}"
ARG PLUGINS_DIR="/root/.terraform.d/plugins"
ARG PROVIDER_RELEASE_URL="https://github.com/banzaicloud/terraform-provider-k8s/releases/download/v${PROVIDER_VERSION}/terraform-provider-k8s_${PROVIDER_VERSION}_linux_amd64.tar.gz"
RUN mkdir -p $PLUGINS_DIR
RUN curl -sL "${PROVIDER_RELEASE_URL}" | tar xvz -C "${PLUGINS_DIR}" -f - "${PROVIDER_NAME}" --transform="s/.*/${TF_PLUGIN_NAME}/"
FROM golang:1.14.1-alpine AS builder
RUN apk update && apk add --no-cache gcc libc-dev git
WORKDIR /build
COPY go.mod .
COPY go.sum .
RUN go mod download
RUN go mod verify
COPY cmd cmd
COPY pkg pkg
COPY main.go main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags='-w -s -extldflags "-static"' -a \
-o rawk8stfc .
FROM base as finish
WORKDIR /usr/local/bin/
COPY --from=builder /build/rawk8stfc /usr/local/bin/rawk8stfc
# Copy over testdata
WORKDIR /test
COPY testdata .
ENTRYPOINT ["/bin/bash", "/test/integration-tests/test-runner.bash"]