perf: 尝试调试缓存 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Cache | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 1 * * *' | |
jobs: | |
build-cache: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
component: [core] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Get Cryptography Version | |
run: | | |
wget https://github.com/jumpserver/jumpserver/raw/master/pyproject.toml | |
cryptography_version=$(awk -F'"' '/cryptography/{print $2}' pyproject.toml) | |
echo "cryptography_version=${cryptography_version}" >> $GITHUB_ENV | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ${{ matrix.component }}/Dockerfile.base | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x | |
push: true | |
build-args: | |
CRYPTOGRAPHY_VERSION=${{ env.cryptography_version }} | |
tags: | | |
${{ github.repository_owner }}/${{ matrix.component }}:base-bookworm | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.component }}:base-bookworm | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |