mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-16 13:56:53 +00:00
perf: change build
perf: using cache perf: using pnpm
This commit is contained in:
parent
1ec3d02933
commit
80f929fdea
61
.github/workflows/build-base-image.yml
vendored
Normal file
61
.github/workflows/build-base-image.yml
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
name: Build and Push Base Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'pr*'
|
||||||
|
paths:
|
||||||
|
- 'package.json'
|
||||||
|
- 'package-lock.json'
|
||||||
|
- 'yarn.lock'
|
||||||
|
- 'Dockerfile-base'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-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: 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: 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/${{ env.REPO }}-base:${{ env.IMAGE_TAG }}
|
||||||
|
|
||||||
|
- 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
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
5
.github/workflows/jms-build-test.yml
vendored
5
.github/workflows/jms-build-test.yml
vendored
@ -12,8 +12,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
component: [lina]
|
component: [ lina ]
|
||||||
version: [v4]
|
version: [ v4 ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
@ -24,6 +24,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
if: env.GITHUB_REPOSITORY_VISIBILITY == 'public'
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
|
32
Dockerfile
32
Dockerfile
@ -1,34 +1,4 @@
|
|||||||
FROM node:16.20-bullseye-slim AS stage-build
|
FROM jumpserver/lina-base:latest AS stage-build
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
ARG DEPENDENCIES=" \
|
|
||||||
g++ \
|
|
||||||
make \
|
|
||||||
python3"
|
|
||||||
|
|
||||||
ARG APT_MIRROR=http://mirrors.ustc.edu.cn
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
||||||
set -ex \
|
|
||||||
&& rm -f /etc/apt/apt.conf.d/docker-clean \
|
|
||||||
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache \
|
|
||||||
&& sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
|
|
||||||
&& echo "no" | dpkg-reconfigure dash
|
|
||||||
|
|
||||||
ARG NPM_REGISTRY="https://registry.npmmirror.com"
|
|
||||||
|
|
||||||
RUN set -ex \
|
|
||||||
&& npm config set registry ${NPM_REGISTRY} \
|
|
||||||
&& yarn config set registry ${NPM_REGISTRY}
|
|
||||||
|
|
||||||
WORKDIR /data
|
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked \
|
|
||||||
--mount=type=bind,source=package.json,target=package.json \
|
|
||||||
--mount=type=bind,source=yarn.lock,target=yarn.lock \
|
|
||||||
yarn install
|
|
||||||
|
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
ENV VERSION=$VERSION
|
ENV VERSION=$VERSION
|
||||||
|
20
Dockerfile-base
Normal file
20
Dockerfile-base
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
FROM node:20.15-bullseye-slim
|
||||||
|
|
||||||
|
ARG DEPENDENCIES=" \
|
||||||
|
g++ \
|
||||||
|
make \
|
||||||
|
python3"
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& rm -f /etc/apt/apt.conf.d/docker-clean \
|
||||||
|
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
|
||||||
|
&& echo "no" | dpkg-reconfigure dash
|
||||||
|
|
||||||
|
WORKDIR /data
|
||||||
|
|
||||||
|
COPY package.json yarn.lock ./
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=yarn-cache \
|
||||||
|
yarn install
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "Lina",
|
"name": "lina",
|
||||||
"version": "v4.0.0",
|
"version": "v4.0.0",
|
||||||
"description": "JumpServer Web UI",
|
"description": "JumpServer Web UI",
|
||||||
"author": "JumpServer Team <support@fit2cloud.com>",
|
"author": "JumpServer Team <support@fit2cloud.com>",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
|
||||||
"build": "vue-cli-service build",
|
"build": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build",
|
||||||
"build:prod": "vue-cli-service build",
|
"build:prod": "vue-cli-service build",
|
||||||
"build:stage": "vue-cli-service build --mode staging",
|
"build:stage": "vue-cli-service build --mode staging",
|
||||||
"preview": "node build/index.js --preview",
|
"preview": "node build/index.js --preview",
|
||||||
@ -30,6 +30,7 @@
|
|||||||
"@ztree/ztree_v3": "3.5.44",
|
"@ztree/ztree_v3": "3.5.44",
|
||||||
"axios": "0.28.0",
|
"axios": "0.28.0",
|
||||||
"axios-retry": "^3.1.9",
|
"axios-retry": "^3.1.9",
|
||||||
|
"caniuse-lite": "^1.0.30001642",
|
||||||
"cron-parser": "^4.0.0",
|
"cron-parser": "^4.0.0",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"css-color-function": "^1.3.3",
|
"css-color-function": "^1.3.3",
|
||||||
|
Loading…
Reference in New Issue
Block a user