Skip to content

Commit

Permalink
deployments(ticdc): improve the docker build time (#8757)
Browse files Browse the repository at this point in the history
close #8758
  • Loading branch information
Rustin170506 authored Apr 9, 2023
1 parent 0d82a60 commit b746456
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 26 deletions.
File renamed without changes.
33 changes: 33 additions & 0 deletions .github/workflows/ticdc_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check Docker Version
run: docker --version
- name: Install Latest Docker
run: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
- name: Check Docker Version
run: docker --version

- name: Free disk space
run: |
sudo rm -rf /usr/local/lib/android
Expand Down Expand Up @@ -78,6 +89,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check Docker Version
run: docker --version
- name: Install Latest Docker
run: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
- name: Check Docker Version
run: docker --version

- name: Free disk space
run: |
sudo rm -rf /usr/local/lib/android
Expand Down Expand Up @@ -130,6 +152,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check Docker Version
run: docker --version
- name: Install Latest Docker
run: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
- name: Check Docker Version
run: docker --version

- name: Free disk space
run: |
sudo rm -rf /usr/local/lib/android
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ format-makefiles: $(MAKE_FILES)
bank:
$(GOBUILD) -ldflags '$(LDFLAGS)' -o bin/bank ./tests/bank/bank.go ./tests/bank/case.go

build-failpoint: check_failpoint_ctl
build-cdc-with-failpoint: check_failpoint_ctl
build-cdc-with-failpoint: ## Build cdc with failpoint enabled.
$(FAILPOINT_ENABLE)
$(GOBUILD) -ldflags '$(LDFLAGS)' -o bin/cdc ./cmd/cdc/main.go
$(FAILPOINT_DISABLE)
Expand All @@ -154,10 +155,6 @@ kafka_consumer:
storage_consumer:
$(GOBUILD) -ldflags '$(LDFLAGS)' -o bin/cdc_storage_consumer ./cmd/storage-consumer/main.go

cdc_test_image:
@which docker || (echo "docker not found in ${PATH}"; exit 1)
docker build --platform linux/amd64 -f deployments/ticdc/docker/test.Dockerfile -t cdc:test ./

install:
go install ./...

Expand Down
2 changes: 1 addition & 1 deletion deployments/ticdc/docker-compose/docker-compose-avro.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: '2.1'
version: '3.5'

services:
controller:
Expand Down
2 changes: 1 addition & 1 deletion deployments/ticdc/docker-compose/docker-compose-canal.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: '2.1'
version: '3.5'

services:
controller:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.1'
version: '3.5'

services:
zookeeper:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.1'
version: '3.5'

services:
mysql_integration_test:
Expand Down
2 changes: 1 addition & 1 deletion deployments/ticdc/docker-compose/docker-compose-mysql.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: '2.1'
version: '3.5'

services:
controller:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.1'
version: '3.5'

services:
storage_integration_test:
Expand Down
9 changes: 3 additions & 6 deletions deployments/ticdc/docker/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
FROM golang:1.20-alpine as builder
RUN apk add --no-cache git make bash
RUN apk add --no-cache git make bash findutils
WORKDIR /go/src/github.com/pingcap/tiflow
COPY . .
ENV CDC_ENABLE_VENDOR=1
RUN go mod vendor
RUN make failpoint-enable
RUN make cdc
RUN make failpoint-disable

RUN --mount=type=cache,target=/root/.cache/go-build,target=/go/pkg/mod make build-cdc-with-failpoint

FROM alpine:3.15
RUN apk add --no-cache tzdata bash curl socat
Expand Down
3 changes: 2 additions & 1 deletion deployments/ticdc/docker/kafka-consumer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ RUN apk add --no-cache make bash
WORKDIR /go/src/github.com/pingcap/tiflow
COPY . .

RUN make kafka_consumer
RUN --mount=type=cache,target=/go/pkg/mod go mod download
RUN --mount=type=cache,target=/root/.cache/go-build make kafka_consumer

FROM alpine:3.15
COPY --from=builder /go/src/github.com/pingcap/tiflow/bin/cdc_kafka_consumer /cdc_kafka_consumer
Expand Down
4 changes: 2 additions & 2 deletions deployments/ticdc/docker/storage-consumer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ FROM golang:1.20-alpine as builder
RUN apk add --no-cache make bash
WORKDIR /go/src/github.com/pingcap/tiflow
COPY . .

RUN make storage_consumer
RUN --mount=type=cache,target=/go/pkg/mod go mod download
RUN --mount=type=cache,target=/root/.cache/go-build make storage_consumer

FROM alpine:3.15
COPY --from=builder /go/src/github.com/pingcap/tiflow/bin/cdc_storage_consumer /cdc_storage_consumer
Expand Down
6 changes: 0 additions & 6 deletions deployments/ticdc/docker/test.Dockerfile

This file was deleted.

0 comments on commit b746456

Please sign in to comment.