forked from Mirantis/compose-on-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.buildkit
80 lines (67 loc) · 3.11 KB
/
Dockerfile.buildkit
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
72
73
74
75
76
77
78
79
80
# syntax = docker/dockerfile-upstream:1.0.1-experimental
ARG BUILD_BASE
ARG RUN_BASE
ARG KUBERNETES_VERSION
FROM ${RUN_BASE} AS runbase
RUN apk add ca-certificates --no-cache
FROM runbase AS unprivileged
RUN adduser -D compose
USER compose
WORKDIR /home/compose
FROM ${BUILD_BASE} AS build
RUN apk add --no-cache \
coreutils \
make \
git \
curl
ARG GOPROXY
WORKDIR /go/src/github.com/docker/compose-on-kubernetes
COPY . .
ARG BUILDTIME
ARG GITCOMMIT
ARG VERSION
ARG IMAGE_REPO_PREFIX
ARG KUBERNETES_VERSION
ENV GITCOMMIT=$GITCOMMIT VERSION=$VERSION BUILDTIME=$BUILDTIME IMAGE_REPO_PREFIX=$IMAGE_REPO_PREFIX KUBERNETES_VERSION=$KUBERNETES_VERSION
ENV CGO_ENABLED=0
RUN --mount=target=/root/.cache,type=cache make bin/compose-controller bin/compose-controller.test e2e-binary bin/installer bin/api-server bin/api-server.test bin/e2e_benchmark
RUN go get github.com/onsi/ginkgo/ginkgo
RUN curl -fLO https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl && \
chmod +x ./kubectl && \
mv ./kubectl /bin/kubectl
# e2e-tests (retrieved with --target=compose-e2e-tests)
# image is publised as docker/kube-compose-e2e-tests, and used for docker/orca e2e tests
FROM runbase AS compose-e2e-tests
RUN apk add jq --no-cache
ENTRYPOINT ["/ginkgo","-v", "-p", "--nodes=10", "/e2e.test", "--"]
COPY --from=build /go/bin/ginkgo /ginkgo
COPY --from=build /go/src/github.com/docker/compose-on-kubernetes/e2e/e2e.test /e2e.test
COPY --from=build /go/src/github.com/docker/compose-on-kubernetes/e2e/retrieve-coverage /retrieve-coverage
COPY --from=build /bin/kubectl /bin/kubectl
# e2e-benchmark
FROM runbase AS compose-e2e-benchmark
ENTRYPOINT ["/e2e_benchmark", "--kubeconfig=/kind-config", "--"]
COPY --from=build /go/src/github.com/docker/compose-on-kubernetes/bin/e2e_benchmark /e2e_benchmark
COPY --from=build /bin/kubectl /bin/kubectl
# compose-installer (retrieved with --target=compose-installer)
FROM runbase AS compose-installer
ENTRYPOINT ["/installer"]
COPY --from=build /go/src/github.com/docker/compose-on-kubernetes/bin/installer /installer
# compose-api-server (retrieved with --target=compose-api-server)
FROM unprivileged AS compose-api-server
ENTRYPOINT ["/api-server"]
COPY --from=build /go/src/github.com/docker/compose-on-kubernetes/bin/api-server /api-server
# compose-api-server with instrumentation (retrieved with --target=compose-api-server-coverage)
FROM unprivileged AS compose-api-server-coverage
ENTRYPOINT ["/api-server-coverage"]
ADD e2e/api-server-coverage /
COPY --from=build /go/src/github.com/docker/compose-on-kubernetes/bin/api-server.test /api-server.test
# instrumented runtime image (retrieved with --target=compose-controller-coverage)
FROM unprivileged AS compose-controller-coverage
ENTRYPOINT ["/compose-controller-coverage"]
ADD e2e/compose-controller-coverage /
COPY --from=build /go/src/github.com/docker/compose-on-kubernetes/bin/compose-controller.test /compose-controller.test
# main runtime image (default target)
FROM unprivileged
ENTRYPOINT ["/compose-controller"]
COPY --from=build /go/src/github.com/docker/compose-on-kubernetes/bin/compose-controller /compose-controller