From d83157f2724f6ef643da2457722dcaea9ceee5b1 Mon Sep 17 00:00:00 2001 From: "guozhi.li" Date: Wed, 7 Dec 2022 14:36:05 +0800 Subject: [PATCH] rabbitmq --- .github/workflows/release.yml | 10 ++--- .../rabbitmq-cluster-operator/Dockerfile | 41 +++++++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 arm64/images/rabbitmq-cluster-operator/Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 01203d67a..c4398d032 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ env: ONLINE_REGISTER: ghcr.io/ksmartdata BUILD_PLATFORM: linux/amd64,linux/arm64 jobs: - ot-redis: + rabbitmq-cluster-operator: runs-on: ubuntu-latest steps: - name: Git clone mysql-operator repo @@ -27,14 +27,14 @@ jobs: - name: mysql-operator uses: docker/build-push-action@v3.1.1 with: - context: ./arm64/images/ot-redis - file: ./arm64/images/ot-redis/Dockerfile-release + context: ./arm64/images/rabbitmq-cluster-operator + file: ./arm64/images/rabbitmq-cluster-operator/Dockerfile github-token: ${{ secrets.GITHUB_TOKEN }} push: true platforms: ${{ env.BUILD_PLATFORM }} tags: | - ${{ env.ONLINE_REGISTER }}/ot-redis:v6.2.5-alpine - ${{ env.ONLINE_REGISTER }}/ot-redis:latest + ${{ env.ONLINE_REGISTER }}/rabbitmq-cluster-operator:v1.14.0 + ${{ env.ONLINE_REGISTER }}/rabbitmq-cluster-operator:latest cache-from: type=gha cache-to: type=gha,mode=max # ot-redis-operator: diff --git a/arm64/images/rabbitmq-cluster-operator/Dockerfile b/arm64/images/rabbitmq-cluster-operator/Dockerfile new file mode 100644 index 000000000..8f1737d60 --- /dev/null +++ b/arm64/images/rabbitmq-cluster-operator/Dockerfile @@ -0,0 +1,41 @@ +# Build the manager binary +FROM --platform=$TARGETPLATFORM golang:1.19 as builder + +USER root + +RUN apt update -y + +RUN apt install -y wget gcc unzip +ENV GOPROXY=https://goproxy.cn +ENV GOPATH=/build + +WORKDIR /build +RUN wget -O arm64.zip https://github.com/rabbitmq/cluster-operator/archive/refs/tags/v1.14.0.zip +RUN unzip arm64.zip +WORKDIR /build/cluster-operator-1.14.0 +RUN go mod tidy +# Build +RUN CGO_ENABLED=0 GO111MODULE=on go build -a -tags timetzdata -o manager main.go + +# --------------------------------------- +FROM --platform=$TARGETPLATFORM alpine:latest as etc-builder + +RUN echo "rabbitmq-cluster-operator:x:1000:" > /etc/group && \ + echo "rabbitmq-cluster-operator:x:1000:1000::/home/rabbitmq-cluster-operator:/usr/sbin/nologin" > /etc/passwd + +RUN apk add -U --no-cache ca-certificates + +# --------------------------------------- +FROM --platform=$TARGETPLATFORM scratch + +ARG GIT_COMMIT +LABEL GitCommit=$GIT_COMMIT + +WORKDIR / +COPY --from=builder /build/cluster-operator-1.14.0/manager . +COPY --from=etc-builder /etc/passwd /etc/group /etc/ +COPY --from=etc-builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt + +USER 1000:1000 + +ENTRYPOINT ["/manager"]