-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: using cache perf: using pnpm
- Loading branch information
Showing
5 changed files
with
117 additions
and
63 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Build and Push Base Image | ||
|
||
on: | ||
push: | ||
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: Set repository visibility environment variable | ||
run: echo "REPO_VISIBILITY=$GITHUB_REPOSITORY_VISIBILITY" >> $GITHUB_ENV | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
if: env.REPO_VISIBILITY == 'public' | ||
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 }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,35 +12,36 @@ jobs: | |
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
component: [lina] | ||
version: [v4] | ||
component: [ lina ] | ||
version: [ v4 ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-buildx-action@v3 | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Prepare Build | ||
run: | | ||
sed -i '[email protected]@registry.yarnpkg.com@g' yarn.lock | ||
- name: Prepare Build | ||
run: | | ||
sed -i '[email protected]@registry.yarnpkg.com@g' yarn.lock | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
if: env.GITHUB_REPOSITORY_VISIBILITY == 'public' | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
file: Dockerfile | ||
tags: ghcr.io/jumpserver/${{ matrix.component }}:${{ matrix.version }} | ||
platforms: linux/amd64 | ||
build-args: | | ||
VERSION=${{ matrix.version }} | ||
APT_MIRROR=http://deb.debian.org | ||
NPM_REGISTRY=https://registry.yarnpkg.com | ||
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 Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
file: Dockerfile | ||
tags: ghcr.io/jumpserver/${{ matrix.component }}:${{ matrix.version }} | ||
platforms: linux/amd64 | ||
build-args: | | ||
VERSION=${{ matrix.version }} | ||
APT_MIRROR=http://deb.debian.org | ||
NPM_REGISTRY=https://registry.yarnpkg.com | ||
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{ | ||
"name": "Lina", | ||
"name": "lina", | ||
"version": "v4.0.0", | ||
"description": "JumpServer Web UI", | ||
"author": "JumpServer Team <[email protected]>", | ||
"license": "GPL-3.0-or-later", | ||
"scripts": { | ||
"dev": "vue-cli-service serve", | ||
"serve": "vue-cli-service serve", | ||
"build": "vue-cli-service build", | ||
"dev": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve", | ||
"serve": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve", | ||
"build": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build", | ||
"build:prod": "vue-cli-service build", | ||
"build:stage": "vue-cli-service build --mode staging", | ||
"preview": "node build/index.js --preview", | ||
|