Skip to content

Commit

Permalink
Add s390x support on multiarch docker images (jaegertracing#2948)
Browse files Browse the repository at this point in the history
  • Loading branch information
kun-lu20 authored Jun 30, 2021
1 parent 127293d commit 78d2f7d
Show file tree
Hide file tree
Showing 27 changed files with 297 additions and 237 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci-all-in-one-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
jobs:
all-in-one:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/[email protected]
with:
Expand All @@ -31,6 +36,12 @@ jobs:

- name: Install tools
run: make install-ci

- uses: docker/setup-qemu-action@v1

- uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host

- name: Build, test, and publish all-in-one image
run: bash scripts/build-all-in-one-image.sh
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci-crossdock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
jobs:
crossdock:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
matrix:
steps:
Expand All @@ -33,6 +38,12 @@ jobs:

- name: Install tools
run: make install-ci

- uses: docker/setup-qemu-action@v1

- uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host

- name: Build, test, and publish ${{ matrix.steps.name }} image
run: ${{ matrix.steps.cmd }}
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/ci-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ on:
jobs:
docker-images:
runs-on: ubuntu-latest

services:
registry:
image: registry:2
ports:
- 5000:5000

steps:
- uses: actions/[email protected]
with:
Expand All @@ -32,11 +39,14 @@ jobs:
- name: Install tools
run: make install-ci

- name: Build docker images
run: make docker
- uses: docker/setup-qemu-action@v1

- name: Upload docker images
run: bash scripts/upload-all-docker-images.sh
- uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host

- name: Build and upload all docker images
run: bash scripts/build-upload-docker-images.sh
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
11 changes: 11 additions & 0 deletions .github/workflows/ci-hotrod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
jobs:
hotrod:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/[email protected]
with:
Expand All @@ -27,6 +32,12 @@ jobs:

- name: Install tools
run: make install-ci

- uses: docker/setup-qemu-action@v1

- uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host

- name: Build, test, and publish hotrod image
run: bash scripts/hotrod-integration-test.sh
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
jobs:
publish-release:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000

steps:
- uses: actions/[email protected]
with:
Expand Down Expand Up @@ -49,13 +55,14 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
if: steps.package-binaries.outcome == 'success'

- name: Build docker images
id: build-images
run: make docker
- uses: docker/setup-qemu-action@v1

- name: Upload docker images
run: bash scripts/upload-all-docker-images.sh
if: steps.build-images.outcome == 'success'
- uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host

- name: Build and upload all docker images
run: bash scripts/build-upload-docker-images.sh
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
Expand Down
29 changes: 10 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,6 @@ build-collector build-collector-debug:
build-ingester build-ingester-debug:
$(GOBUILD) $(DISABLE_OPTIMIZATIONS) -o ./cmd/ingester/ingester$(SUFFIX)-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/ingester/main.go

.PHONY: docker
docker: build-binaries-linux docker-images-only

.PHONY: build-binaries-linux
build-binaries-linux:
GOOS=linux GOARCH=amd64 $(MAKE) build-platform-binaries
Expand Down Expand Up @@ -308,7 +305,8 @@ build-platform-binaries: build-agent \
build-all-in-one \
build-examples \
build-tracegen \
build-anonymizer
build-anonymizer \
build-esmapping-generator

.PHONY: build-all-platforms
build-all-platforms: build-binaries-linux build-binaries-windows build-binaries-darwin build-binaries-s390x build-binaries-arm64 build-binaries-ppc64le
Expand All @@ -319,9 +317,10 @@ docker-images-cassandra:
@echo "Finished building jaeger-cassandra-schema =============="

.PHONY: docker-images-elastic
docker-images-elastic: build-esmapping-generator-linux
docker-images-elastic:
GOOS=linux GOARCH=$(GOARCH) $(MAKE) build-esmapping-generator
docker build -t $(DOCKER_NAMESPACE)/jaeger-es-index-cleaner:${DOCKER_TAG} plugin/storage/es
docker build -t $(DOCKER_NAMESPACE)/jaeger-es-rollover:${DOCKER_TAG} plugin/storage/es -f plugin/storage/es/Dockerfile.rollover
docker build -t $(DOCKER_NAMESPACE)/jaeger-es-rollover:${DOCKER_TAG} plugin/storage/es -f plugin/storage/es/Dockerfile.rollover --build-arg TARGETARCH=$(GOARCH)
@echo "Finished building jaeger-es-indices-clean =============="

docker-images-jaeger-backend: TARGET = release
Expand Down Expand Up @@ -358,21 +357,13 @@ docker-images-only: docker-images-cassandra \
docker-images-tracegen \
docker-images-anonymizer

.PHONY: docker-push
docker-push:
@while [ -z "$$CONFIRM" ]; do \
read -r -p "Do you really want to push images to repository \"${DOCKER_NAMESPACE}\"? [y/N] " CONFIRM; \
done ; \
if [ $$CONFIRM != "y" ] && [ $$CONFIRM != "Y" ]; then \
echo "Exiting." ; exit 1 ; \
fi
for component in agent cassandra-schema es-index-cleaner es-rollover collector query ingester example-hotrod tracegen anonymizer; do \
docker push $(DOCKER_NAMESPACE)/jaeger-$$component ; \
done
.PHONY: build-crossdock-binary
build-crossdock-binary:
$(GOBUILD) -o ./crossdock/crossdock-$(GOOS)-$(GOARCH) ./crossdock/main.go

.PHONY: build-crossdock-linux
build-crossdock-linux:
GOOS=linux $(GOBUILD) -o ./crossdock/crossdock-linux ./crossdock/main.go
GOOS=linux $(MAKE) build-crossdock-binary

include crossdock/rules.mk

Expand All @@ -385,7 +376,7 @@ build-crossdock-ui-placeholder:

.PHONY: build-crossdock
build-crossdock: build-crossdock-ui-placeholder build-binaries-linux build-crossdock-linux docker-images-cassandra docker-images-jaeger-backend
docker build -t $(DOCKER_NAMESPACE)/test-driver:${DOCKER_TAG} crossdock/
docker build -t $(DOCKER_NAMESPACE)/test-driver:${DOCKER_TAG} --build-arg TARGETARCH=$(GOARCH) crossdock/
@echo "Finished building test-driver ==============" ; \

.PHONY: build-and-run-crossdock
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG base_image
ARG debug_image

FROM $base_image AS release
ARG TARGETARCH=amd64
ARG TARGETARCH
ARG USER_UID=10001
COPY agent-linux-$TARGETARCH /go/bin/agent-linux
EXPOSE 5775/udp 6831/udp 6832/udp 5778/tcp
Expand Down
2 changes: 1 addition & 1 deletion cmd/all-in-one/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG base_image
ARG debug_image

FROM $base_image AS release
ARG TARGETARCH=amd64
ARG TARGETARCH

# Agent zipkin.thrift compact
EXPOSE 5775/udp
Expand Down
2 changes: 1 addition & 1 deletion cmd/anonymizer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM scratch
ARG TARGETARCH=amd64
ARG TARGETARCH

COPY anonymizer-linux-$TARGETARCH /go/bin/anonymizer-linux
ENTRYPOINT ["/go/bin/anonymizer-linux"]
2 changes: 1 addition & 1 deletion cmd/collector/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG base_image
ARG debug_image

FROM $base_image AS release
ARG TARGETARCH=amd64
ARG TARGETARCH
COPY collector-linux-$TARGETARCH /go/bin/collector-linux
EXPOSE 14250/tcp
ENTRYPOINT ["/go/bin/collector-linux"]
Expand Down
2 changes: 1 addition & 1 deletion cmd/ingester/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG base_image
ARG debug_image

FROM $base_image AS release
ARG TARGETARCH=amd64
ARG TARGETARCH
COPY ingester-linux-$TARGETARCH /go/bin/ingester-linux
EXPOSE 14270/tcp 14271/tcp
ENTRYPOINT ["/go/bin/ingester-linux"]
Expand Down
2 changes: 1 addition & 1 deletion cmd/query/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG base_image
ARG debug_image

FROM $base_image AS release
ARG TARGETARCH=amd64
ARG TARGETARCH
COPY query-linux-$TARGETARCH /go/bin/query-linux
EXPOSE 16686/tcp
ENTRYPOINT ["/go/bin/query-linux"]
Expand Down
2 changes: 1 addition & 1 deletion cmd/tracegen/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM scratch
ARG TARGETARCH=amd64
ARG TARGETARCH

COPY tracegen-linux-$TARGETARCH /go/bin/tracegen-linux
ENTRYPOINT ["/go/bin/tracegen-linux"]
3 changes: 2 additions & 1 deletion crossdock/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM scratch
ARG TARGETARCH

COPY crossdock-linux /go/bin/
COPY crossdock-linux-$TARGETARCH /go/bin/crossdock-linux

EXPOSE 8080
ENTRYPOINT ["/go/bin/crossdock-linux"]
13 changes: 8 additions & 5 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
VERSION := 1.0.0
ROOT_IMAGE ?= alpine:3.13
CERT_IMAGE := alpine:3.13
CERT_IMAGE := $(ROOT_IMAGE)
GOLANG_IMAGE := golang:1.15-alpine

BASE_IMAGE := localhost/baseimg:$(VERSION)-$(shell echo $(ROOT_IMAGE) | tr : -)
DEBUG_IMAGE := localhost/debugimg:$(VERSION)-$(shell echo $(GOLANG_IMAGE) | tr : -)
BASE_IMAGE := localhost:5000/baseimg_alpine:latest
DEBUG_IMAGE := localhost:5000/debugimg_alpine:latest
PLATFORMS := linux/amd64,linux/s390x

create-baseimg-debugimg: create-baseimg create-debugimg

create-baseimg:
docker build -t $(BASE_IMAGE) \
docker buildx build -t $(BASE_IMAGE) --push \
--build-arg root_image=$(ROOT_IMAGE) \
--build-arg cert_image=$(CERT_IMAGE) \
--platform=$(PLATFORMS) \
docker/base

create-debugimg:
docker build -t $(DEBUG_IMAGE) \
docker buildx build -t $(DEBUG_IMAGE) --push \
--build-arg golang_image=$(GOLANG_IMAGE) \
--platform=$(PLATFORMS) \
docker/debug
14 changes: 10 additions & 4 deletions docker/debug/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
ARG golang_image

FROM $golang_image AS build
ARG TARGETARCH
ENV GOPATH /go
RUN apk add --update --no-cache ca-certificates make git && \
go get github.com/go-delve/delve/cmd/dlv && \
cd /go/src/github.com/go-delve/delve && \
make install
RUN apk add --update --no-cache ca-certificates make git
#Once go-delve adds support for s390x (see PR #2948), remove this entire conditional.
RUN if [[ "$TARGETARCH" != "s390x" ]] ; then \
go get github.com/go-delve/delve/cmd/dlv && \
cd /go/src/github.com/go-delve/delve && \
make install; \
else \
touch /go/bin/dlv; \
fi

FROM $golang_image
COPY --from=build /go/bin/dlv /go/bin/dlv
Expand Down
2 changes: 1 addition & 1 deletion examples/hotrod/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM scratch
ARG TARGETARCH=amd64
ARG TARGETARCH
EXPOSE 8080 8081 8082 8083
COPY hotrod-linux-$TARGETARCH /go/bin/hotrod-linux
ENTRYPOINT ["/go/bin/hotrod-linux"]
Expand Down
3 changes: 2 additions & 1 deletion plugin/storage/es/Dockerfile.rollover
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM python:3-alpine3.11
ARG TARGETARCH

# Temporary fix for https://github.com/jaegertracing/jaeger/issues/1494
RUN pip install urllib3==1.24.3

RUN pip install elasticsearch elasticsearch-curator
COPY ./mappings/* /mappings/
COPY esRollover.py /es-rollover/
COPY esmapping-generator /usr/bin/
COPY esmapping-generator-linux-$TARGETARCH /usr/bin/esmapping-generator

ENTRYPOINT ["python3", "/es-rollover/esRollover.py"]
Loading

0 comments on commit 78d2f7d

Please sign in to comment.