Skip to content

Merge branch 'main' of https://github.com/sijinhui/build-image #1

Merge branch 'main' of https://github.com/sijinhui/build-image

Merge branch 'main' of https://github.com/sijinhui/build-image #1

Workflow file for this run

name: build python
on:
push:
branches:
- main
paths:
- 'gitlab/**'
- '.github/workflows/gitlab.yml'
jobs:
deploy:
name: 打包并上传python
runs-on: ubuntu-latest
# runs-on: self-hosted
steps:
-
name: Checkout
uses: actions/checkout@v3
-
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Build and push multi-platform Docker image
uses: docker/build-push-action@v3
with:
context: ./python
file: ./python/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/python:3.9.18-alpine
upload_to_aliyun:
needs: deploy
name: 上传镜像到阿里云
# runs-on: ubuntu-latest
runs-on: self-hosted
steps:
-
name: Log in to Aliyun Docker
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALY_DOCKER_USERNAME }}
password: ${{ secrets.ALY_DOCKER_PASSWORD }}
- name: Sync repository to ALY
run: |
docker pull gitlab/gitlab-ee:latest
docker tag gitlab/gitlab-ee:latest registry.cn-hangzhou.aliyuncs.com/${{ secrets.DOCKERHUB_USERNAME }}/gitlab-ee:latest
docker push registry.cn-hangzhou.aliyuncs.com/${{ secrets.DOCKERHUB_USERNAME }}/gitlab-ee:latest