Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
80bdbf6b
authored
Mar 11, 2024
by
Carson Yang
Committed by
GitHub
Mar 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs: update workflow for building docs image (#968)
Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
parent
9f0b1d6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
64 deletions
+55
-64
.github/workflows/docs-image.yml
+55
-64
No files found.
.github/workflows/docs-image.yml
View file @
80bdbf6b
...
...
@@ -8,82 +8,67 @@ on:
-
'
main'
tags
:
-
'
v*.*.*'
jobs
:
build-fastgpt-docs-images
:
runs-on
:
ubuntu-
20.04
runs-on
:
ubuntu-
latest
steps
:
-
name
:
Checkout
uses
:
actions/checkout@v3
uses
:
actions/checkout@v4
-
name
:
Get current date and time
id
:
datetime
run
:
echo "datetime=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT"
-
name
:
Docker meta
id
:
meta
uses
:
docker/metadata-action@v5
with
:
fetch-depth
:
1
-
name
:
Set up QEMU (optional)
uses
:
docker/setup-qemu-action@v2
# list of Docker images to use as base name for tags
images
:
|
${{ secrets.DOCKER_HUB_NAME }}/fastgpt-docs
ghcr.io/${{ github.repository_owner }}/fastgpt-docs
registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALI_HUB_USERNAME }}/fastgpt-docs
tags
:
|
${{ steps.datetime.outputs.datetime }}
flavor
:
latest=false
-
name
:
Set up QEMU
uses
:
docker/setup-qemu-action@v3
-
name
:
Set up Docker Buildx
uses
:
docker/setup-buildx-action@v2
with
:
driver-opts
:
network=host
-
name
:
Cache Docker layers
uses
:
actions/cache@v2
uses
:
docker/setup-buildx-action@v3
-
name
:
Login to DockerHub
uses
:
docker/login-action@v3
with
:
path
:
/tmp/.buildx-cache
key
:
${{ runner.os }}-buildx-${{ github.sha }}
restore-keys
:
|
${{ runner.os }}-buildx-
-
name
:
Login to GitHub Container Registry
uses
:
docker/login-action@v2
username
:
${{ secrets.DOCKER_HUB_NAME }}
password
:
${{ secrets.DOCKER_HUB_PASSWORD }}
-
name
:
Login to ghcr.io
uses
:
docker/login-action@v3
with
:
registry
:
ghcr.io
username
:
${{ github.repository_owner }}
password
:
${{ secrets.GH_PAT }}
-
name
:
Set DOCKER_REPO_TAGGED based on branch or tag
run
:
|
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-docs:latest" >> $GITHUB_ENV
else
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-docs:${{ github.ref_name }}" >> $GITHUB_ENV
fi
-
name
:
Build and publish image for main branch or tag push event
env
:
DOCKER_REPO_TAGGED
:
${{ env.DOCKER_REPO_TAGGED }}
run
:
|
docker buildx build \
--build-arg name=app \
--platform linux/amd64,linux/arm64 \
--label "org.opencontainers.image.source= https://github.com/ ${{ github.repository_owner }}/FastGPT" \
--label "org.opencontainers.image.description=fastgpt image" \
--label "org.opencontainers.image.licenses=Apache" \
--push \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
-t ${DOCKER_REPO_TAGGED} \
-f docSite/Dockerfile \
.
push-to-docker-hub
:
needs
:
build-fastgpt-docs-images
runs-on
:
ubuntu-20.04
if
:
github.repository == 'labring/FastGPT'
steps
:
-
name
:
Checkout code
uses
:
actions/checkout@v3
-
name
:
Login to Docker Hub
uses
:
docker/login-action@v2
-
name
:
Login to Aliyun
uses
:
docker/login-action@v3
with
:
username
:
${{ secrets.DOCKER_HUB_NAME }}
password
:
${{ secrets.DOCKER_HUB_PASSWORD }}
-
name
:
Set DOCKER_REPO_TAGGED based on branch or tag
run
:
|
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
else
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
fi
-
name
:
Pull image from GitHub Container Registry
run
:
docker pull ghcr.io/${{ github.repository_owner }}/fastgpt-docs:${{env.IMAGE_TAG}}
-
name
:
Tag image with Docker Hub repository name and version tag
run
:
docker tag ghcr.io/${{ github.repository_owner }}/fastgpt-docs:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
-
name
:
Push image to Docker Hub
run
:
docker push ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
registry
:
registry.cn-hangzhou.aliyuncs.com
username
:
${{ secrets.ALI_HUB_USERNAME }}
password
:
${{ secrets.ALI_HUB_PASSWORD }}
-
name
:
Build and push Docker images to ghcr.io and DockerHub
uses
:
docker/build-push-action@v5
with
:
context
:
.
file
:
./docSite/Dockerfile
push
:
true
tags
:
${{ steps.meta.outputs.tags }}
labels
:
${{ steps.meta.outputs.labels }}
outputs
:
tags
:
${{ steps.datetime.outputs.datetime }}
update-docs-image
:
needs
:
build-fastgpt-docs-images
runs-on
:
ubuntu-20.04
...
...
@@ -95,4 +80,9 @@ jobs:
env
:
KUBE_CONFIG
:
${{ secrets.KUBE_CONFIG }}
with
:
args
:
rollout restart deployment fastgpt-docs
args
:
set image deployment/fastgpt-docs fastgpt-docs=registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALI_HUB_USERNAME }}/fastgpt-docs:${{ needs.build-fastgpt-docs-images.outputs.tags }}
-
uses
:
actions-hub/kubectl@master
env
:
KUBE_CONFIG
:
${{ secrets.KUBE_CONFIG }}
with
:
args
:
annotate deployment/fastgpt-docs originImageName="registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALI_HUB_USERNAME }}/fastgpt-docs:${{ needs.build-fastgpt-docs-images.outputs.tags }}" --overwrite
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment