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

This commit is contained in:
吴小白
2024-05-28 10:40:35 +08:00
committed by 老广
parent 91a1da57e9
commit 0b65e3ffda
5 changed files with 120 additions and 241 deletions

View File

@@ -1,36 +1,62 @@
name: "Run Build Test"
on:
push:
branches:
- pr@*
- repr@*
paths:
- 'Dockerfile'
- 'Dockerfile*'
- 'Dockerfile-*'
- 'pyproject.toml'
- 'poetry.lock'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- 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 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: Build CE Image
uses: docker/build-push-action@v5
with:
context: .
push: false
push: true
file: Dockerfile
tags: jumpserver/core-ce:test
tags: ghcr.io/jumpserver/core:v4-lite
platforms: linux/amd64
build-args: |
VERSION=v4
APT_MIRROR=http://deb.debian.org
PIP_MIRROR=https://pypi.org/simple
PIP_JMS_MIRROR=https://pypi.org/simple
BASE_IMAGE=ghcr.io/jumpserver/core
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@# FROM registry.fit2cloud.com@g' Dockerfile-ee
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
@@ -39,11 +65,12 @@ jobs:
context: .
push: false
file: Dockerfile-ee
tags: jumpserver/core-ee:test
tags: jumpserver/core:v4
platforms: linux/amd64
build-args: |
VERSION=v4
APT_MIRROR=http://deb.debian.org
PIP_MIRROR=https://pypi.org/simple
PIP_JMS_MIRROR=https://pypi.org/simple
BASE_IMAGE=ghcr.io/jumpserver/core
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max