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

大佬,可以新增个yml,直接推送到镜像仓库 #22

Closed
wangyunan2018 opened this issue Oct 20, 2024 · 0 comments
Closed

大佬,可以新增个yml,直接推送到镜像仓库 #22

wangyunan2018 opened this issue Oct 20, 2024 · 0 comments

Comments

@wangyunan2018
Copy link

name: Docker Image CI
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:

  • name: Checkout code
    uses: actions/checkout@v3
  • name: Set up Docker Buildx
    uses: docker/setup-buildx-action@v2
  • name: Login to DockerHub
    uses: docker/login-action@v2
    with:
    username: ${{ secrets.DOCKERHUB_USERNAME }}
    password: ${{ secrets.DOCKERHUB_PASSWORD }}
  • name: Pull Docker image
    run: docker pull elasticsearch:7.17.9
  • name: Tag Docker image
    run: docker tag elasticsearch:7.17.9 registry-crs-huadong1.ctyun.cn/xxx/public:elasticsearch-7.17.9
  • name: Login to Custom Registry
    uses: docker/login-action@v2
    with:
    registry: registry-crs-huadong1.ctyun.cn
    username: ${{ secrets.CUSTOM_REGISTRY_USERNAME }}
    password: ${{ secrets.CUSTOM_REGISTRY_PASSWORD }}
  • name: Push Docker image
    run: docker push registry-crs-huadong1.ctyun.cn/xxx/public:elasticsearch-7.17.9
  • name: Clean up Docker to free space
    run: |
    docker system prune -a -f
    docker volume prune -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants