From 5e56590405f6bb4d390a00a336f0ac02e4469718 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 13 Nov 2025 17:32:51 +0800 Subject: [PATCH] perf: change base img (#16279) * perf: change base img * perf: add gcc * perf: change base image * perf: Update Dockerfile with new base image tag --------- Co-authored-by: ibuler Co-authored-by: github-actions[bot] --- .github/workflows/build-base-image.yml | 120 ++++++++++++------------- Dockerfile | 4 +- Dockerfile-base | 3 +- requirements/mac_pkg.sh | 1 + 4 files changed, 64 insertions(+), 64 deletions(-) diff --git a/.github/workflows/build-base-image.yml b/.github/workflows/build-base-image.yml index 4b177d3fd..3f6a680ca 100644 --- a/.github/workflows/build-base-image.yml +++ b/.github/workflows/build-base-image.yml @@ -1,74 +1,72 @@ name: Build and Push Base Image on: - pull_request: - branches: - - 'dev' - - 'v*' - paths: - - poetry.lock - - pyproject.toml - - Dockerfile-base - - package.json - - go.mod - - yarn.lock - - pom.xml - - install_deps.sh - - utils/clean_site_packages.sh - types: - - opened - - synchronize - - reopened + pull_request: + branches: + - 'dev' + - 'v*' + paths: + - poetry.lock + - pyproject.toml + - Dockerfile-base + - package.json + - go.mod + - yarn.lock + - pom.xml + - install_deps.sh + - utils/clean_site_packages.sh + types: + - opened + - synchronize + - reopened jobs: - build-and-push: - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} + build-and-push: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - with: - image: tonistiigi/binfmt:qemu-v7.0.0-28 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Extract date - id: vars - run: echo "IMAGE_TAG=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV + - name: Extract date + id: vars + run: echo "IMAGE_TAG=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV - - name: Extract repository name - id: repo - run: echo "REPO=$(basename ${{ github.repository }})" >> $GITHUB_ENV + - name: Extract repository name + id: repo + run: echo "REPO=$(basename ${{ github.repository }})" >> $GITHUB_ENV - - name: Build and push multi-arch image - uses: docker/build-push-action@v6 - with: - platforms: linux/amd64,linux/arm64 - push: true - file: Dockerfile-base - tags: jumpserver/core-base:${{ env.IMAGE_TAG }} + - name: Build and push multi-arch image + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + file: Dockerfile-base + tags: jumpserver/core-base:${{ env.IMAGE_TAG }} - - name: Update Dockerfile - run: | - sed -i 's|-base:.* AS stage-build|-base:${{ env.IMAGE_TAG }} AS stage-build|' Dockerfile + - name: Update Dockerfile + run: | + sed -i 's|-base:.* AS stage-build|-base:${{ env.IMAGE_TAG }} AS stage-build|' Dockerfile - - name: Commit changes - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git add Dockerfile - git commit -m "perf: Update Dockerfile with new base image tag" - git push origin ${{ github.event.pull_request.head.ref }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Commit changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add Dockerfile + git commit -m "perf: Update Dockerfile with new base image tag" + git push origin ${{ github.event.pull_request.head.ref }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index ce5752653..61f9b44ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM jumpserver/core-base:20251111_065955 AS stage-build +FROM jumpserver/core-base:20251113_092612 AS stage-build ARG VERSION @@ -19,7 +19,7 @@ RUN set -ex \ && python manage.py compilemessages -FROM python:3.11.14-trixie +FROM python:3.11-slim-trixie ENV LANG=en_US.UTF-8 \ PATH=/opt/py3/bin:$PATH diff --git a/Dockerfile-base b/Dockerfile-base index bcb685938..701946aa7 100644 --- a/Dockerfile-base +++ b/Dockerfile-base @@ -1,4 +1,4 @@ -FROM python:3.11.14-trixie +FROM python:3.11.14-slim-trixie ARG TARGETARCH # Install APT dependencies ARG DEPENDENCIES=" \ @@ -43,6 +43,7 @@ ARG PIP_MIRROR=https://pypi.org/simple ENV ANSIBLE_COLLECTIONS_PATHS=/opt/py3/lib/python3.11/site-packages/ansible_collections ENV LANG=en_US.UTF-8 \ PATH=/opt/py3/bin:$PATH +ENV SETUPTOOLS_SCM_PRETEND_VERSION=3.4.5 RUN --mount=type=cache,target=/root/.cache \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ diff --git a/requirements/mac_pkg.sh b/requirements/mac_pkg.sh index 3e19608d9..88857bca9 100644 --- a/requirements/mac_pkg.sh +++ b/requirements/mac_pkg.sh @@ -18,6 +18,7 @@ fi echo "4. For Apple processor" LDFLAGS="-L$(brew --prefix freetds)/lib -L$(brew --prefix openssl@1.1)/lib" CFLAGS="-I$(brew --prefix freetds)/include" pip install $(grep 'pymssql' requirements.txt) +export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql-client/lib/pkgconfig" echo "5. Install Ansible Receptor"