forked from portworx/torpedo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (54 loc) · 2.28 KB
/
Dockerfile
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
60
61
62
63
64
65
66
67
68
69
70
71
FROM golang:1.19.5-alpine AS build
LABEL maintainer="[email protected]"
ARG MAKE_TARGET
WORKDIR /go/src/github.com/portworx/torpedo
# Install setup dependencies
RUN apk update && apk add --no-cache bash git gcc musl-dev make curl openssh-client
RUN GOFLAGS= GO111MODULE=on go install github.com/onsi/ginkgo/[email protected]
# Install aws-iam-authenticator
# This is needed by test running inside EKS cluster and creating aws entities like bucket etc.
RUN mkdir bin && \
curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.16.8/2020-04-16/bin/linux/amd64/aws-iam-authenticator && \
chmod a+x aws-iam-authenticator && \
mv aws-iam-authenticator bin
# Install IBM Cloud SDK
RUN curl -fsSL https://clis.cloud.ibm.com/install/linux | sh && \
ibmcloud plugin install -f vpc-infrastructure && \
ibmcloud plugin install -f container-service
# No need to copy *everything*. This keeps the cache useful
COPY vendor vendor
COPY Makefile Makefile
COPY go.mod go.mod
COPY go.sum go.sum
COPY pkg pkg
COPY porx porx
COPY scripts scripts
COPY drivers drivers
COPY deployments deployments
# Why? Errors if this is removed
COPY .git .git
# copy tests last to allow caching of the previous docker image layers
COPY tests tests
# Compile
RUN --mount=type=cache,target=/root/.cache/go-build make $MAKE_TARGET
# Build a fresh container with just the binaries
FROM alpine
RUN apk add --no-cache ca-certificates bash curl jq libc6-compat
# Install kubectl from Docker Hub.
COPY --from=lachlanevenson/k8s-kubectl:latest /usr/local/bin/kubectl /usr/local/bin/kubectl
# Install helm from Docker Hub
COPY --from=alpine/helm:latest /usr/bin/helm /usr/local/bin/helm
# Copy scripts into container
WORKDIR /torpedo
COPY deployments deployments
COPY scripts scripts
WORKDIR /go/src/github.com/portworx/torpedo
# Copy ginkgo & binaries over from previous container
COPY --from=build /go/bin/ginkgo /bin/ginkgo
COPY --from=build /go/src/github.com/portworx/torpedo/bin bin
COPY --from=build /go/src/github.com/portworx/torpedo/bin/aws-iam-authenticator /bin/aws-iam-authenticator
COPY --from=build /usr/local/bin/ibmcloud /bin/ibmcloud
COPY --from=build /root/.bluemix/plugins /root/.bluemix/plugins
COPY drivers drivers
ENTRYPOINT ["ginkgo", "--failFast", "--slowSpecThreshold", "180", "-v", "-trace"]
CMD []