Skip to content

Commit

Permalink
Fix docker build. (#4977)
Browse files Browse the repository at this point in the history
Fix docker image build, which has been broken since July 5th.
Tested by building normally & via docker - both locally and in buildkite.

- tcheck wasn't being found, but David and I agree that it seems unnecessary and doesn't seem to be used any more.
- Bash wasn't found in the image, but is needed to run scripts/check-gomod-version.sh, so I added it to the alpine image.
- During docker image build, the protoc binary had 644 permissions but needed to be executed so I added +x
- During docker image build, the PROTO_OUT/uber/cadence directory doesn't exist, so we skip the cp/rm commands that fail otherwise.
  • Loading branch information
ZackLK authored Aug 27, 2022
1 parent c8783f0 commit 172abd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
12 changes: 1 addition & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@ ARG TARGET=server
# Can be used in case a proxy is necessary
ARG GOPROXY

# Build tcheck binary
FROM golang:1.17.13-alpine3.15 AS tcheck

WORKDIR /go/src/github.com/uber/tcheck

COPY go.* ./
RUN go build -mod=readonly -o /go/bin/tcheck github.com/uber/tcheck

# Build Cadence binaries
FROM golang:1.17.13-alpine3.15 AS builder

ARG RELEASE_VERSION

RUN apk add --update --no-cache ca-certificates make git curl mercurial unzip
RUN apk add --update --no-cache ca-certificates make git curl mercurial unzip bash

WORKDIR /cadence

Expand Down Expand Up @@ -68,7 +60,6 @@ FROM alpine AS cadence-server
ENV CADENCE_HOME /etc/cadence
RUN mkdir -p /etc/cadence

COPY --from=tcheck /go/bin/tcheck /usr/local/bin
COPY --from=dockerize /usr/local/bin/dockerize /usr/local/bin
COPY --from=builder /cadence/cadence-cassandra-tool /usr/local/bin
COPY --from=builder /cadence/cadence-sql-tool /usr/local/bin
Expand Down Expand Up @@ -105,7 +96,6 @@ CMD /start.sh
# Cadence CLI
FROM alpine AS cadence-cli

COPY --from=tcheck /go/bin/tcheck /usr/local/bin
COPY --from=builder /cadence/cadence /usr/local/bin

ENTRYPOINT ["cadence"]
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ $(BUILD)/protoc: $(PROTO_FILES) $(BIN)/$(PROTOC_VERSION_BIN) $(BIN)/protoc-gen-g
$(call ensure_idl_submodule)
$Q mkdir -p $(PROTO_OUT)
$Q echo "protoc..."
$Q chmod +x $(BIN)/$(PROTOC_VERSION_BIN)
$Q $(foreach PROTO_DIR,$(PROTO_DIRS),$(EMULATE_X86) $(BIN)/$(PROTOC_VERSION_BIN) \
--plugin $(BIN)/protoc-gen-gogofast \
--plugin $(BIN)/protoc-gen-yarpc-go \
Expand All @@ -290,8 +291,11 @@ $(BUILD)/protoc: $(PROTO_FILES) $(BIN)/$(PROTOC_VERSION_BIN) $(BIN)/protoc-gen-g
--yarpc-go_out=$(PROTO_OUT) \
$$(find $(PROTO_DIR) -name '*.proto');\
)
$Q cp -R $(PROTO_OUT)/uber/cadence/* $(PROTO_OUT)/
$Q rm -r $(PROTO_OUT)/uber
$Q # This directory exists for local/buildkite but not for docker builds.
$Q if [ -d "$(PROTO_OUT)/uber/cadence" ]; then \
cp -R $(PROTO_OUT)/uber/cadence/* $(PROTO_OUT)/; \
rm -r $(PROTO_OUT)/uber; \
fi
$Q touch $@

# ====================================
Expand Down

0 comments on commit 172abd6

Please sign in to comment.