forked from argoproj/argo-events
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
114 lines (92 loc) · 4.54 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
####################################################################################################
# Builder image
# Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image
# Also used as the image in CI jobs so needs all dependencies
####################################################################################################
FROM golang:1.13.4 as builder
RUN apt-get update && apt-get --no-install-recommends install -y \
git \
make \
apt-utils \
apt-transport-https \
ca-certificates \
wget \
gcc \
zip && \
apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base
WORKDIR /tmp
####################################################################################################
# Argo Build stage which performs the actual build of Argo binaries
####################################################################################################
FROM builder as build
ARG IMAGE_OS=linux
# Perform the build
WORKDIR /go/src/github.com/argoproj/argo-events
COPY . .
# check we can use Git
RUN git rev-parse HEAD
# Make sure there are not prebuilt binaries
RUN rm dist/*
# eventbus-controller
RUN . hack/image_arch.sh && make dist/eventbus-controller-linux-${IMAGE_ARCH}
# eventsource-controller
RUN . hack/image_arch.sh && make dist/eventsource-controller-linux-${IMAGE_ARCH}
# sensor-controller
RUN . hack/image_arch.sh && make dist/sensor-controller-linux-${IMAGE_ARCH}
# eventsource
RUN . hack/image_arch.sh && make dist/eventsource-linux-${IMAGE_ARCH}
# sensor
RUN . hack/image_arch.sh && make dist/sensor-linux-${IMAGE_ARCH}
####################################################################################################
# eventbus-controller
####################################################################################################
FROM scratch as eventbus-controller
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/src/github.com/argoproj/argo-events/dist/eventbus-controller /bin/eventbus-controller
ENTRYPOINT [ "/bin/eventbus-controller" ]
####################################################################################################
# eventsource-controller
####################################################################################################
FROM scratch as eventsource-controller
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/src/github.com/argoproj/argo-events/dist/eventsource-controller /bin/eventsource-controller
ENTRYPOINT [ "/bin/eventsource-controller" ]
####################################################################################################
# sensor-controller
####################################################################################################
FROM scratch as sensor-controller
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/src/github.com/argoproj/argo-events/dist/sensor-controller /bin/sensor-controller
ENTRYPOINT [ "/bin/sensor-controller" ]
####################################################################################################
# eventsource
####################################################################################################
FROM scratch as eventsource
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/src/github.com/argoproj/argo-events/dist/eventsource /bin/eventsource
ENTRYPOINT [ "/bin/eventsource" ]
####################################################################################################
# sensor
####################################################################################################
FROM alpine as sensor
RUN apk update && apk upgrade && \
apk add --no-cache git
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# Argo Workflow CLI
COPY assets/argo-linux-amd64 /usr/local/bin/argo
RUN chmod +x /usr/local/bin/argo
RUN argo version || true
COPY --from=build /go/src/github.com/argoproj/argo-events/dist/sensor /bin/sensor
ENTRYPOINT [ "/bin/sensor" ]