Skip to content

Commit

Permalink
feat(ci): distribution building CI
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Nov 27, 2023
1 parent 9238783 commit cfe4d7c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 16 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/release-distributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: release images

on:
push:
tags:
- "observer-*"
- "obproxy-*"
- "obagent-*"
- "obconfigserver-*"

env:
tagName: ${{ github.ref_name }}

jobs:
release-images:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set Version variables
id: set_version_vars
run: echo "version=$(echo $tagName | grep -P \"(\d*\.\d*\.\d*\.\d*-\d{18})\" --only-matching)" >> $GITHUB_OUTPUT

- name: Build and push observer w/o cache
uses: docker/build-push-action@v2
if: ${{ startWith(github.ref_name, "observer-") }}
with:
context: ./distribution/oceanbase
platforms: linux/amd64,linux/arm64
file: ./distribution/oceanbase/Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/oceanbase-cloud-native:${{ steps.set_version_vars.outputs.version }}
build-args: |
VERSION:${{ steps.set_version_vars.outputs.version }}
11 changes: 0 additions & 11 deletions .github/workflows/release-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,13 @@ on:
tags:
- '*[0-9].*[0-9].*[0-9]*'

env:
GO_VERSION: "1.20"

jobs:
release-images:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: go mod vendor
run: go mod vendor

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand Down
9 changes: 4 additions & 5 deletions distribution/oceanbase/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
FROM golang:1.20.4 as builder
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /workspace
COPY ./oceanbase-helper .
RUN GO11MODULE=ON CGO_ENABLED=0 GOOS=linux go build -a -o oceanbase-helper main.go
RUN GO11MODULE=ON CGO_ENABLED=0 GOOS=linux GOPROXY=https://goproxy.io,direct go build -a -o oceanbase-helper main.go

FROM openanolis/anolisos:8.8
ARG VERSION
ARG ARCH=x86_64
WORKDIR /home/admin/oceanbase
RUN mkdir -p /home/admin/oceanbase/bin
COPY --from=builder /workspace/oceanbase-helper /home/admin/oceanbase/bin
RUN yum -y install python27
RUN pip2 install mysql-connector -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
RUN yum install -y http://mirrors.aliyun.com/oceanbase/community/stable/el/8/${ARCH}/oceanbase-ce-libs-${VERSION}.el8.${ARCH}.rpm
RUN yum install -y http://mirrors.aliyun.com/oceanbase/community/stable/el/8/${ARCH}/oceanbase-ce-${VERSION}.el8.${ARCH}.rpm
# support docker platform linux/amd64 and linux/arm64, mapping platform to x86_64 or aarch64
RUN if [[ $TARGETPLATFORM == "linux/amd64" ]]; then yum install -y http://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/oceanbase-ce-libs-${VERSION}.el8.x86_64.rpm; else yum install -y http://mirrors.aliyun.com/oceanbase/community/stable/el/8/aarch64/oceanbase-ce-libs-${VERSION}.el8.aarch64.rpm; fi
RUN if [[ $TARGETPLATFORM == "linux/amd64" ]]; then yum install -y http://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/oceanbase-ce-${VERSION}.el8.x86_64.rpm; else yum install -y http://mirrors.aliyun.com/oceanbase/community/stable/el/8/aarch64/oceanbase-ce-libs-${VERSION}.el8.aarch64.rpm; fi
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ENV LD_LIBRARY_PATH /home/admin/oceanbase/lib

0 comments on commit cfe4d7c

Please sign in to comment.