Skip to content

添加python

添加python #5

Workflow file for this run

name: build python
on:
push:
branches:
- main
paths:
- 'python/**'
jobs:
deploy:
name: 打包并上传python
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- 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@v5
with:
context: ./python
file: ./python/Dockerfile
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/python:3.9.18-alpine
upload_to_aliyun:
needs: deploy
name: 上传镜像到阿里云
runs-on: z4
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 ${{ secrets.DOCKERHUB_USERNAME }}/python:3.9.18-alpine
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/python:3.9.18-alpine registry.cn-hangzhou.aliyuncs.com/${{ secrets.DOCKERHUB_USERNAME }}/python:3.9.18-alpine
docker tag registry.cn-hangzhou.aliyuncs.com/${{ secrets.DOCKERHUB_USERNAME }}/python:3.9.18-alpine registry.cn-hangzhou.aliyuncs.com/${{ secrets.DOCKERHUB_USERNAME }}/python
docker push registry.cn-hangzhou.aliyuncs.com/${{ secrets.DOCKERHUB_USERNAME }}/python:3.9.18-alpine
docker push registry.cn-hangzhou.aliyuncs.com/${{ secrets.DOCKERHUB_USERNAME }}/python