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

Aishang1993 patch 1 #1

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Docker Image CI

on:
push:
branches: [ main ]
branches: [ mainxx ]
pull_request:
branches: [ main ]
branches: [ mainxx ]

jobs:

Expand All @@ -18,8 +18,8 @@ jobs:
run: |
docker version
# 登录阿里云镜像仓库
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }} registry.cn-shenzhen.aliyuncs.com
docker login --username=${{ secrets.USERNAME }} --password=${{ secrets.PASSWORD }} registry.cn-shenzhen.aliyuncs.com
# 使用Dockerfile构建镜像
docker build . --file Dockerfile --tag registry.cn-shenzhen.aliyuncs.com/devan/hanlp-jupyterlab
docker build . --file Dockerfile --tag registry.cn-shenzhen.aliyuncs.com/public-x/hanlp-jupyterlab
# 推送镜像到镜像仓库
docker push registry.cn-shenzhen.aliyuncs.com/devan/hanlp-jupyterlab
docker push registry.cn-shenzhen.aliyuncs.com/public-x/hanlp-jupyterlab
55 changes: 55 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Pull and Push Docker Image

on:
workflow_dispatch:
inputs:
src_image:
description: '请填写docker镜像名称'
required: true
default: 'alpine:latest' # 设置默认的 Docker 镜像名称
desc_image:
description: '请填写docker镜像名称'
required: false
default: 'alpine:latest' # 设置默认的 Docker 镜像名称

jobs:
pull-and-push:
runs-on: ubuntu-latest

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

- name: Clean up Docker to free space
run: |
docker system prune -a -f
docker volume prune -f

- name: Pull Docker Image and Package
run: |
image="${{ github.event.inputs.src_image }}"
docker pull "${image}" --platform "linux/amd64"

- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}

- name: Set default desc_image if not provided
id: set_desc_image
run: | if [ -z "${{ github.event.inputs.desc_image }}" ]; then
echo "::set-output name=desc_image::${{ github.event.inputs.src_image }}"
else
echo "::set-output name=desc_image::${{ github.event.inputs.desc_image }}"
fi

- name: Push Image to Docker Registry
run: |
image="${{ secrets.DOCKER_REGISTRY }}/${{ steps.set_desc_image.desc_image }}"
docker tag "${{ github.event.inputs.src_image }}" "${image}"
docker push "${image}"

- name: Logout from Docker Registry
run: docker logout ${{ secrets.DOCKER_REGISTRY }}
43 changes: 43 additions & 0 deletions .github/workflows/pull-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Pull and Push Docker Image

on:
workflow_dispatch:
inputs:
docker_image:
description: '请填写docker镜像名称'
required: true
default: 'alpine:latest' # 设置默认的 Docker 镜像名称

jobs:
pull-and-push:
runs-on: ubuntu-latest

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

- name: Clean up Docker to free space
run: |
docker system prune -a -f
docker volume prune -f

- name: Pull Docker Image and Package
run: |
image="${{ github.event.inputs.docker_image }}"
docker pull "${image}" --platform "linux/amd64"

- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}

- name: Push Image to Docker Registry
run: |
image="${{ github.event.inputs.docker_image }}"
docker tag "${image}" "${{ secrets.DOCKER_REGISTRY }}/${image}"
docker push "${{ secrets.DOCKER_REGISTRY }}/${image}"

- name: Logout from Docker Registry
run: docker logout ${{ secrets.DOCKER_REGISTRY }}