forked from temporalio/temporal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
85 lines (66 loc) · 2.98 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
ARG TARGET=server
ARG BASE_BUILDER_IMAGE=temporalio/base-builder:1.4.0
ARG BASE_SERVER_IMAGE=temporalio/base-server:1.3.0
ARG BASE_ADMIN_TOOLS_IMAGE=temporalio/base-admin-tools:1.2.0
ARG GOPROXY
##### Temporal builder #####
FROM ${BASE_BUILDER_IMAGE} AS temporal-builder
WORKDIR /temporal
# Copy go.mod/go.sum first to build docker layer with go dependencies (to improve rebuild time).
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN make bins
##### Temporal server #####
FROM ${BASE_SERVER_IMAGE} AS temporal-server
WORKDIR /etc/temporal
ENV TEMPORAL_HOME /etc/temporal
ENV SERVICES "history:matching:frontend:worker"
EXPOSE 6933 6934 6935 6939 7233 7234 7235 7239
# TODO (alex): switch WORKDIR to /home/temporal and remove "mkdir" and "chown" calls.
RUN addgroup -g 1000 temporal
RUN adduser -u 1000 -G temporal -D temporal
RUN mkdir /etc/temporal/config
RUN chown -R temporal:temporal /etc/temporal/config
USER temporal
ENTRYPOINT ["./entrypoint.sh"]
COPY config/dynamicconfig /etc/temporal/config/dynamicconfig
COPY docker/config_template.yaml /etc/temporal/config/config_template.yaml
COPY docker/entrypoint.sh /etc/temporal/entrypoint.sh
COPY docker/start-temporal.sh /etc/temporal/start-temporal.sh
COPY --from=temporal-builder /temporal/tctl /usr/local/bin
COPY --from=temporal-builder /temporal/tctl-authorization-plugin /usr/local/bin
COPY --from=temporal-builder /temporal/temporal-server /usr/local/bin
##### Auto setup Temporal server #####
FROM temporal-server AS temporal-auto-setup
CMD ["autosetup"]
COPY docker/auto-setup.sh /etc/temporal/auto-setup.sh
COPY --from=temporal-builder /temporal/schema /etc/temporal/schema
COPY --from=temporal-builder /temporal/temporal-cassandra-tool /usr/local/bin
COPY --from=temporal-builder /temporal/temporal-sql-tool /usr/local/bin
##### Development configuration for Temporal with additional set of tools #####
FROM temporal-auto-setup as temporal-develop
# apk and setup-develop.sh requires root permissions.
USER root
# iproute2 contains tc, which can be used for traffic shaping in resiliancy testing.
ONBUILD RUN apk add iproute2
CMD ["autosetup", "develop"]
COPY docker/setup-develop.sh /etc/temporal/setup-develop.sh
##### Temporal CLI (tctl) #####
FROM ${BASE_SERVER_IMAGE} AS temporal-tctl
WORKDIR /etc/temporal
ENTRYPOINT ["tctl"]
COPY --from=temporal-builder /temporal/tctl /usr/local/bin
COPY --from=temporal-builder /temporal/tctl-authorization-plugin /usr/local/bin
##### Temporal admin tools #####
FROM ${BASE_ADMIN_TOOLS_IMAGE} as temporal-admin-tools
WORKDIR /etc/temporal
# Keep the container running.
ENTRYPOINT ["tail", "-f", "/dev/null"]
COPY --from=temporal-builder /temporal/schema /etc/temporal/schema
COPY --from=temporal-builder /temporal/temporal-cassandra-tool /usr/local/bin
COPY --from=temporal-builder /temporal/temporal-sql-tool /usr/local/bin
COPY --from=temporal-builder /temporal/tctl /usr/local/bin
COPY --from=temporal-builder /temporal/tctl-authorization-plugin /usr/local/bin
##### Build requested image #####
FROM temporal-${TARGET}