Clean up main Dockerfile (#1177)

This commit is contained in:
Alex Shtin
2021-01-12 11:59:00 -08:00
committed by GitHub
parent 8df573c346
commit 92b2901896
2 changed files with 23 additions and 23 deletions
+22 -22
View File
@@ -6,28 +6,27 @@ ARG GOPROXY
# Build Temporal binaries
FROM golang:1.15-alpine AS builder
RUN apk add --update --no-cache ca-certificates make curl git mercurial protobuf
RUN apk add --update --no-cache \
make \
git
# Making sure that dependency is not touched
ENV GOFLAGS="-mod=readonly"
WORKDIR /temporal
# Copy go mod dependencies and build cache
# Copy go mod dependencies first and build docker cache
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 make
RUN CGO_ENABLED=0 make bins
# Download dockerize
FROM alpine:3.12 AS dockerize
RUN apk add --no-cache openssl
ENV DOCKERIZE_VERSION v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
@@ -38,7 +37,12 @@ RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSI
# Alpine base image
FROM alpine:3.12 AS alpine
RUN apk add --update --no-cache ca-certificates tzdata bash curl vim
RUN apk add --update --no-cache \
ca-certificates \
tzdata \
bash \
curl \
vim
# set up nsswitch.conf for Go's "netgo" implementation
# https://github.com/gliderlabs/docker-alpine/issues/367#issuecomment-424546457
@@ -46,13 +50,9 @@ RUN test ! -e /etc/nsswitch.conf && echo 'hosts: files dns' > /etc/nsswitch.conf
SHELL ["/bin/bash", "-c"]
# Temporal server
FROM alpine AS temporal-server
RUN apk add --update --no-cache ca-certificates py-pip mysql-client \
&& pip install cqlsh
ENV TEMPORAL_HOME /etc/temporal
RUN mkdir -p /etc/temporal
@@ -63,9 +63,9 @@ COPY --from=builder /temporal/tctl /usr/local/bin
COPY --from=builder /temporal/temporal-server /usr/local/bin
COPY --from=builder /temporal/schema /etc/temporal/schema
COPY docker/entrypoint.sh /docker-entrypoint.sh
COPY docker/entrypoint.sh /entrypoint.sh
COPY config/dynamicconfig /etc/temporal/config/dynamicconfig
COPY docker/config_template.yaml /etc/temporal/config
COPY docker/config_template.yaml /etc/temporal/config/config_template.yaml
COPY docker/start-temporal.sh /start-temporal.sh
COPY docker/start.sh /start.sh
@@ -74,7 +74,7 @@ WORKDIR /etc/temporal
ENV SERVICES="history:matching:frontend:worker"
EXPOSE 6933 6934 6935 6939 7233 7234 7235 7239
ENTRYPOINT ["/docker-entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
CMD /start.sh
# All-in-one Temporal server
@@ -91,23 +91,23 @@ ENTRYPOINT ["tctl"]
# All temporal tool binaries
FROM alpine AS temporal-admin-tools
RUN apk add --update --no-cache jq
RUN apk add --update --no-cache \
jq \
mysql-client \
postgresql-client \
python2 \
&& curl https://bootstrap.pypa.io/get-pip.py | python \
&& pip install cqlsh
ENV TEMPORAL_HOME /etc/temporal
RUN mkdir -p /etc/temporal
COPY --from=dockerize /usr/local/bin/dockerize /usr/local/bin
COPY --from=builder /temporal/temporal-cassandra-tool /usr/local/bin
COPY --from=builder /temporal/temporal-sql-tool /usr/local/bin
COPY --from=builder /temporal/tctl /usr/local/bin
COPY --from=builder /temporal/temporal-server /usr/local/bin
COPY --from=builder /temporal/schema /etc/temporal/schema
COPY docker/entrypoint.sh /docker-entrypoint.sh
COPY docker/config_template.yaml /etc/temporal/config/config_template.yaml
COPY docker/start-temporal.sh /start-temporal.sh
WORKDIR /usr/local/bin
WORKDIR /etc/temporal
# keep the container running
ENTRYPOINT ["tail", "-f", "/dev/null"]
+1 -1
View File
@@ -2,7 +2,7 @@
# Install all tools and builds binaries.
install: update-tools bins
# Rebuild binaries.
# Rebuild binaries (used by Dockerfile).
bins: clean-bins temporal-server tctl temporal-cassandra-tool temporal-sql-tool
# Install all tools, recompile proto files, run all possible checks and tests (long but comprehensive).