perf: 按要求移除重复构建代码

This commit is contained in:
吴小白
2024-05-30 11:56:40 +08:00
committed by 老广
parent 21bb0a8162
commit 3536af2051
4 changed files with 74 additions and 105 deletions

View File

@@ -11,8 +11,12 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
component: [core]
version: [v4]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
@@ -21,21 +25,10 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Base Image
uses: docker/build-push-action@v5
with:
context: .
push: true
file: Dockerfile.base
tags: ghcr.io/jumpserver/core:v4-base
platforms: linux/amd64
build-args: |
APT_MIRROR=http://deb.debian.org
PIP_MIRROR=https://pypi.org/simple
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Prepare Build
run: |
sed -i 's@^FROM registry.fit2cloud.com/jumpserver@FROM ghcr.io/jumpserver@g' Dockerfile-ee
- name: Build CE Image
uses: docker/build-push-action@v5
@@ -43,34 +36,28 @@ jobs:
context: .
push: true
file: Dockerfile
tags: ghcr.io/jumpserver/core:v4-lite
tags: ghcr.io/jumpserver/${{ matrix.component }}:${{ matrix.version }}-ce
platforms: linux/amd64
build-args: |
VERSION=v4
VERSION=${{ matrix.version }}
APT_MIRROR=http://deb.debian.org
BASE_IMAGE=ghcr.io/jumpserver/core
PIP_MIRROR=https://pypi.org/simple
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Prepare EE Image
run: |
sed -i 's@^FROM registry.fit2cloud.com/jumpserver/xpack@# FROM registry.fit2cloud.com/jumpserver/xpack@' Dockerfile-ee
sed -i 's@^FROM registry.fit2cloud.com/jumpserver@FROM ghcr.io/jumpserver@g' Dockerfile-ee
sed -i 's@^COPY --from=build-xpack@# COPY --from=build-xpack@g' Dockerfile-ee
- name: Build EE Image
uses: docker/build-push-action@v5
with:
context: .
push: false
file: Dockerfile-ee
tags: jumpserver/core:v4
tags: ghcr.io/jumpserver/${{ matrix.component }}:${{ matrix.version }}
platforms: linux/amd64
build-args: |
VERSION=v4
VERSION=${{ matrix.version }}
APT_MIRROR=http://deb.debian.org
BASE_IMAGE=ghcr.io/jumpserver/core
PIP_MIRROR=https://pypi.org/simple
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max