Fix idk package_docker_all CI job (#2196)

Before, we were building docker images for IDK for each of the four
linux/darwin amd64/arm64 platfrom/arch combinations, which didn't make
sense. If we want to later build docker images for linux/arm64, we can
add that later.

I also cleaned up the Dockerfile for IDK to minimize creation of excess
layers (by &&-ing RUN commands), and made apt quieter to cut back some
of the noise.
This commit is contained in:
Garrison Davis 2022-08-18 13:52:04 -06:00 • committed by GitHub
parent 11fe9f0cad
commit 9eb6b3ac3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 19 deletions

View file

@ -638,16 +638,9 @@ idk package_docker_all:
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web")'
script:
- cd ./idk/
- make docker GOOS="linux" GOARCH="amd64"
- make docker GOOS="linux" GOARCH="arm64"
- make docker GOOS="darwin" GOARCH="amd64"
- make docker GOOS="darwin" GOARCH="arm64"
- make docker-idk GOOS="linux" GOARCH="amd64"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- make docker-tag-push GOOS="linux" GOARCH="amd64"
- make docker-tag-push GOOS="linux" GOARCH="arm64"
- make docker-tag-push GOOS="darwin" GOARCH="amd64"
- make docker-tag-push GOOS="darwin" GOARCH="arm64"
- make docker-idk-tag-push GOOS="linux" GOARCH="amd64"
needs:
- job: idk build_all
- job: idk build_linux_arm64

View file

@ -251,6 +251,22 @@ docker-tag-push: vendor
docker push $(DOCKER_TARGET)
@echo Pushed docker image: $(DOCKER_TARGET)
# These commands (docker-idk and docker-idk-tag-push)
# are designed to be used in CI.
# docker-idk builds idk docker images and tags them - intended for use in CI.
docker-idk: vendor
docker build \
-f idk/Dockerfile \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg MAKE_FLAGS="GOOS=$(GOOS) GOARCH=$(GOARCH) BUILD_CGO=$(BUILD_CGO)" \
--tag registry.gitlab.com/molecula/featurebase/idk:$(VERSION_ID) .
@echo Created docker image: registry.gitlab.com/molecula/featurebase/idk:$(VERSION_ID)
# docker-idk-tag-push pushes tagged docker images to the GitLab container
# registry - intended for use in CI.
docker-idk-tag-push:
docker push registry.gitlab.com/molecula/featurebase/idk:$(VERSION_ID)
@echo Pushed docker image: registry.gitlab.com/molecula/featurebase/idk:$(VERSION_ID)
# Install diagnostic pilosa-keydump tool. Allows viewing the keys in a transaction-engine directory.
pilosa-keydump:
$(GO) install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa-keydump

View file

@ -3,13 +3,19 @@ ARG GO_VERSION=1.17.8
FROM golang:1.17.8-stretch as builder
WORKDIR /
RUN ["apt-get","update","-y"]
RUN ["apt-get","install","-y","git","unixodbc","unixodbc-dev","netcat", "build-essential","musl-tools"]
RUN apt-get update -y -qq && apt-get install -y -qq \
build-essential \
git \
musl-tools \
netcat \
unixodbc \
unixodbc-dev \
&& rm -rf /var/lib/apt/lists/*
RUN ["git", "clone", "https://github.com/edenhill/librdkafka.git"]
WORKDIR /librdkafka
RUN ["./configure", "--prefix", "/usr"]
RUN ["make"]
RUN ["make", "install"]
RUN ./configure --prefix /usr && \
make && \
make install
WORKDIR /featurebase
@ -24,12 +30,15 @@ RUN make build GO_BUILD_FLAGS="-mod=vendor ${GO_BUILD_FLAGS}" ${MAKE_FLAGS}
FROM ubuntu:20.04 as runner
RUN ["apt-get","update","-y"]
RUN ["apt-get","install","-y","unixodbc-dev","netcat","ca-certificates", "musl-tools"]
RUN apt-get update -y -qq && apt-get install -y -qq \
ca-certificates \
musl-tools \
netcat \
unixodbc-dev \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /idk/bin/* /usr/local/bin/
COPY /docker-sasl/ssl_keys /etc/kafka/secrets
COPY --from=builder /featurebase/idk/bin/* /usr/local/bin/
COPY ./idk/docker-sasl/ssl_keys /etc/kafka/secrets
# Verify that the linker can find everything.
FROM runner as linkcheck