mirror of
https://github.com/TeamPGM/PagerMaid-Pyro.git
synced 2024-11-22 03:19:17 +00:00
b0a807b82c
为 Alpine 容器清空 pip cache 并自动构建 alpine 容器
78 lines
2.3 KiB
YAML
78 lines
2.3 KiB
YAML
name: Docker_alpine
|
|
|
|
# This workflow uses actions that are not certified by GitHub.
|
|
# They are provided by a third-party and are governed by
|
|
# separate terms of service, privacy policy, and support
|
|
# documentation.
|
|
|
|
on:
|
|
push:
|
|
branches: [ development ]
|
|
|
|
env:
|
|
# Use docker.io for Docker Hub if empty
|
|
REGISTRY: ghcr.io
|
|
# github.repository as <account>/<repo>
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
# This is used to complete the identity challenge
|
|
# with sigstore/fulcio when running outside of PRs.
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Pull Repo
|
|
run: |
|
|
git clone --branch $GITHUB_REF_NAME --depth 1 https://github.com/${GITHUB_REPOSITORY} repo
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
with:
|
|
platforms: all
|
|
|
|
- name: Setup Docker buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# Login against a Docker registry except on PR
|
|
# https://github.com/docker/login-action
|
|
- name: Log into registry ${{ env.REGISTRY }}
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Extract metadata (tags, labels) for Docker
|
|
# https://github.com/docker/metadata-action
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
flavor: |
|
|
latest=false
|
|
tags: |
|
|
type=edge,suffix=-alpine,branch=development
|
|
type=sha,suffix=-alpine
|
|
|
|
# Build and push Docker image with Buildx (don't push on PR)
|
|
# https://github.com/docker/build-push-action
|
|
- name: Build and push Docker image
|
|
id: build-and-push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
context: ./repo
|
|
file: ./repo/Dockerfile.alpine
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }} |