Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sync image to aliyuns repo #4282

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 50 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,67 @@ on:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Build Release

env:
# TODO: Change variable to your image's name.
IMAGE_NAME: ks-console
IMAGE_REPO: kubesphere

jobs:
release-linux-amd64:
release:
runs-on: ubuntu-latest
if: github.repository == 'kubesphere/console'
steps:
- uses: actions/checkout@v2

- name: Login to Aliyun
uses: docker/login-action@v3
with:
registry: registry.cn-beijing.aliyuncs.com
username: ${{ secrets.ALIYUNCS_USERNAME }}
password: ${{ secrets.ALIYUNCS_PASSWORD }}

- name: Login to DOCKER
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Set up Docker buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Log into registry
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Chose Registry by tag
id: chose_registry
run: |
if [[ ${GITHUB_REF#refs/*/} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "env=prod" >> "$GITHUB_OUTPUT"
else
echo "env=dev" >> "$GITHUB_OUTPUT"
fi
echo "tag=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"

- name: Push image
- name: Generate output dir
run: |
TAG=${GITHUB_REF#refs/*/} REPO=$IMAGE_REPO make container-cross-push
echo "Push $IMAGE success!"
make container-cross

- name: Build and push ks-console images
uses: docker/build-push-action@v6
if: steps.chose_registry.outputs.env == 'prod'
with:
context: ${{ github.workspace }}
file: build/Dockerfile.dapper
platforms: linux/amd64,linux/arm64
push: true
tags: |
docker.io/kubesphere/ks-console:${{ steps.chose_registry.outputs.tag }}
registry.cn-beijing.aliyuncs.com/kubesphereio/ks-console:${{ steps.chose_registry.outputs.tag }}

- name: Build and push ks-console dev images
uses: docker/build-push-action@v6
if: steps.chose_registry.outputs.env == 'dev'
with:
context: ${{ github.workspace }}
file: build/Dockerfile.dapper
platforms: linux/amd64,linux/arm64
push: true
tags: |
docker.io/kubespheredev/ks-console:${{ steps.chose_registry.outputs.tag }}
22 changes: 9 additions & 13 deletions hack/docker_build_multiarch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ set -o pipefail

TAG=${TAG:-latest}
REPO=${REPO:-kubespheredev}
PUSH=${PUSH:-}
DRY_RUN=${DRY_RUN:-false}

# support other container tools. e.g. podman
CONTAINER_CLI=${CONTAINER_CLI:-docker}
CONTAINER_BUILDER=${CONTAINER_BUILDER:-"buildx build"}

# If set, just building, no pushing
if [[ -z "${DRY_RUN:-}" ]]; then
PUSH="--push"
fi

## supported platforms
PLATFORMS=linux/amd64,linux/arm64

Expand All @@ -39,10 +34,11 @@ mv "$PROJECT_DIR"/server/locales \
"$PROJECT_DIR"/server/sample \
"$PROJECT_DIR"/server/configs "$PROJECT_DIR"/out/server/

# shellcheck disable=SC2086 # inteneded splitting of CONTAINER_BUILDER
${CONTAINER_CLI} ${CONTAINER_BUILDER} \
--platform ${PLATFORMS} \
${PUSH} \
-f build/Dockerfile.dapper \
-t "${REPO}"/ks-console:"${TAG}" .

if [ "$DRY_RUN" = "false" ]; then
# shellcheck disable=SC2086 # inteneded splitting of CONTAINER_BUILDER
${CONTAINER_CLI} ${CONTAINER_BUILDER} \
--platform ${PLATFORMS} \
--push \
-f build/Dockerfile.dapper \
-t "${REPO}"/ks-console:"${TAG}" .
fi
Loading