Skip to content

Commit

Permalink
CI: add build image workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankGTY committed Sep 26, 2024
1 parent 69ac991 commit 6ba1be6
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 6 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
51 changes: 51 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build and Push Docker Image

on:
push:
branches:
- main
- 'release/*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest

- name: Docker login
env:
DOCKER_USERNAME: ${{ secrets.ALIYUN_REGISTRY_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin registry.cn-shanghai.aliyuncs.com
- name: Extract branch name
id: extract_branch
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV

- name: Extract Tag
id: extract_tag
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}

- name: Run buildx
run: |
tag=latest
if [[ "${{ steps.extract_branch.outputs.branch }}" == "main" ]];then
tag=latest
elif [[ "${{ steps.extract_tag.outputs.version }}" == v* ]]; then
tag="${{ steps.extract_tag.outputs.version }}"
fi
echo extract_tag ${{ steps.extract_tag.outputs.version }}
echo extract_branch ${{ steps.extract_branch.outputs.branch }}
echo current tag is ${tag}
docker buildx build --platform linux/amd64,linux/arm64 --push -f deploy/docker/Dockerfile -t registry.cn-shanghai.aliyuncs.com/openhydra/aes-ai-tutor:${tag} .
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
REGISTRY ?= hub.sh.99cloud.net
REGISTRY ?= registry.cn-shanghai.aliyuncs.com/openhydra

IMAGETAG ?= $(shell git rev-parse --abbrev-ref HEAD)-$(shell git rev-parse --verify HEAD)-$(shell date -u '+%Y%m%d%I%M%S')
BRANCH ?= $(shell git branch --show-current)

.PHONY: image
image:
docker build -t $(REGISTRY)/aes/aes-ai-tutor:$(IMAGETAG) -f deploy/docker/Dockerfile . --load
docker build -t $(REGISTRY)/aes-ai-tutor:$(IMAGETAG) -f deploy/docker/Dockerfile . --load

.PHONY: image-then-push
image-then-push:
docker build -t $(REGISTRY)/aes/aes-ai-tutor:$(IMAGETAG) -f deploy/docker/Dockerfile . --load
docker tag $(REGISTRY)/aes/aes-ai-tutor:$(IMAGETAG) $(REGISTRY)/aes/aes-ai-tutor:$(BRANCH)
docker push $(REGISTRY)/aes/aes-ai-tutor:$(IMAGETAG)
docker push $(REGISTRY)/aes/aes-ai-tutor:$(BRANCH)
docker build -t $(REGISTRY)/aes-ai-tutor:$(IMAGETAG) -f deploy/docker/Dockerfile . --load
docker tag $(REGISTRY)/aes-ai-tutor:$(IMAGETAG) $(REGISTRY)/aes/aes-ai-tutor:$(BRANCH)
docker push $(REGISTRY)/aes-ai-tutor:$(IMAGETAG)
docker push $(REGISTRY)/aes-ai-tutor:$(BRANCH)

0 comments on commit 6ba1be6

Please sign in to comment.