Skip to content
Closed
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
81 changes: 81 additions & 0 deletions .github/workflows/upload_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Upload Image
on:
push:
branches:
- master

jobs:
build-specific-architecture:
strategy:
matrix:
arch: [amd64, arm64]
runs-on: ${{ fromJson('{"amd64":"ubuntu-latest", "arm64":["self-hosted", "Linux", "ARM64"]}')[matrix.arch] }}
steps:
- name: checkout codes
uses: actions/checkout@v2

- uses: actions/setup-node@v3
with:
node-version: 14

- name: install dependencies
run: |
sudo apt update -y
sudo apt install g++ build-essential python3 -y

- name: build web-show images
env:
ARCH: ${{ matrix.arch }}
run: |
make build
IMAGE_TAG=latest-$ARCH make image

- name: log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: upload web-show
env:
ARCH: ${{ matrix.arch }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
run: |
# ${VAR,,} convert VAR to lower case
docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-$ARCH


upload-manifest:
runs-on: ubuntu-latest
needs: build-specific-architecture
steps:
- name: build manifest
env:
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
run: |
# ${VAR,,} convert VAR to lower case
docker manifest create ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest \
ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-amd64 \
ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-arm64

docker manifest annotate ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest \
ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-amd64 \
--os linux --arch amd64
docker manifest annotate ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest \
ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest-arm64 \
--os linux --arch arm64

- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Chaos Mesh
env:
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
run: |
# ${VAR,,} convert VAR to lower case
docker manifest push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/web-show:latest
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SET DOCKER_REGISTRY to change the docker registry
DOCKER_REGISTRY_PREFIX := $(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/,)
DOCKER_REGISTRY_PREFIX := $(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/,ghcr.io/)
IMAGE_TAG := $(if $(IMAGE_TAG),$(IMAGE_TAG),"latest")

# Enable GO111MODULE=on explicitly, disable it with GO111MODULE=off when necessary.
export GO111MODULE := on
Expand All @@ -16,10 +17,10 @@ build:
cd web; npm install; npm run build

image:
docker build -t ${DOCKER_REGISTRY_PREFIX}pingcap/web-show .
docker build -t ${DOCKER_REGISTRY_PREFIX}chaos-mesh/web-show:${IMAGE_TAG} .

image-push:
docker push "${DOCKER_REGISTRY_PREFIX}pingcap/web-show:latest"
docker push "${DOCKER_REGISTRY_PREFIX}chaos-mesh/web-show:latest"


.PYTHON: build
Loading