Skip to content

Commit

Permalink
add '-tags musl' build parameter to resolve confluent-kafka-go compat…
Browse files Browse the repository at this point in the history
…ibility problem (#94)

Co-authored-by: 段超 <[email protected]>
  • Loading branch information
sixther-dc and 段超 authored Apr 7, 2021
1 parent 5358016 commit 35b4564
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 143 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
args: --timeout=10m
args: --timeout=10m --out-format=colored-line-number
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true
skip-go-installation: true
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
skip-pkg-cache: true
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ build-all:

build: build-version submodule tidy
cd "${BUILD_PATH}" && \
${GO_BUILD_ENV} go build ${VERSION_OPS} -o "${PROJ_PATH}/bin/${APP_NAME}"
${GO_BUILD_ENV} go build ${VERSION_OPS} ${GO_BUILD_MUSL_TAGS} -o "${PROJ_PATH}/bin/${APP_NAME}"

build-cross: build-version submodule
cd "${BUILD_PATH}" && \
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} ${GO_BUILD_ENV} go build ${VERSION_OPS} -o "${PROJ_PATH}/bin/${GOOS}-${GOARCH}-${APP_NAME}"
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} ${GO_BUILD_ENV} go build ${VERSION_OPS} ${GO_BUILD_MUSL_TAGS} -o "${PROJ_PATH}/bin/${GOOS}-${GOARCH}-${APP_NAME}"

build-for-linux:
GOOS=linux GOARCH=amd64 make build-cross
Expand Down
28 changes: 28 additions & 0 deletions build/dockerfiles/Dockerfile-scheduler
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ARG BASE_DOCKER_IMAGE
FROM ${BASE_DOCKER_IMAGE} as build

RUN mkdir -p "$GOPATH/src/github.com/erda-project/erda/"
COPY . "$GOPATH/src/github.com/erda-project/erda/"
WORKDIR "$GOPATH/src/github.com/erda-project/erda/"

ARG APP_NAME
ARG CONFIG_PATH
ARG MODULE_PATH
ARG DOCKER_IMAGE
RUN make build APP_NAME=${APP_NAME} MODULE_PATH=${MODULE_PATH} DOCKER_IMAGE=${DOCKER_IMAGE} GO_BUILD_MUSL_TAGS="--tags musl"

ARG BASE_DOCKER_IMAGE
FROM ${BASE_DOCKER_IMAGE}

RUN apk add --no-cache jq

WORKDIR /app

ARG APP_NAME
ARG CONFIG_PATH
ENV APP_NAME=${APP_NAME}
COPY --from=build "$GOPATH/src/github.com/erda-project/erda/bin/${APP_NAME}" "/app/${APP_NAME}"
COPY --from=build "$GOPATH/src/github.com/erda-project/erda/conf/${CONFIG_PATH}" "/app/conf/${CONFIG_PATH}"
COPY --from=build "$GOPATH/src/github.com/erda-project/erda/pkg/dice-configs" "/app/dice-configs"

CMD ["sh", "-c", "/app/${APP_NAME}"]
Loading

0 comments on commit 35b4564

Please sign in to comment.