Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
perf: 优化构建
Browse files Browse the repository at this point in the history
  • Loading branch information
wojiushixiaobai committed Mar 29, 2024
1 parent 7ee7d16 commit 3dfaf91
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 83 deletions.
40 changes: 22 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@ jobs:
version=$(cat VERSION)
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Create Tag
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a ${{ steps.get-version.outputs.version }} -m "Release Version ${{ steps.get-version.outputs.version }}" || echo "Tag already exists"
git push origin ${{ steps.get-version.outputs.version }} || echo "Tag already exists"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
run: |
gh release create ${{ steps.get-version.outputs.version }} --notes "Release ${{ steps.get-version.outputs.version }}" || echo "Release already exists"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3

Expand All @@ -53,6 +38,10 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare files
run: |
bash prepare.sh
- name: Build and push
uses: docker/build-push-action@v3
with:
Expand All @@ -61,8 +50,23 @@ jobs:
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/mips64le
push: true
tags: |
jumpserver/web-static:${{ steps.get-version.outputs.version }}-bookworm
ghcr.io/jumpserver/web-static:${{ steps.get-version.outputs.version }}-bookworm
jumpserver/web-static:${{ steps.get-version.outputs.version }}
ghcr.io/jumpserver/web-static:${{ steps.get-version.outputs.version }}
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max

- name: Create Tag
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a ${{ steps.get-version.outputs.version }} -m "Release Version ${{ steps.get-version.outputs.version }}" || echo "Tag already exists"
git push origin ${{ steps.get-version.outputs.version }} || echo "Tag already exists"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
run: |
gh release create ${{ steps.get-version.outputs.version }} --notes "Release ${{ steps.get-version.outputs.version }}" || echo "Release already exists"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64 changes: 2 additions & 62 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,3 @@
FROM debian:bookworm-slim
FROM scratch
ARG TARGETARCH

LABEL org.opencontainers.image.source https://github.com/jumpserver/web-static

RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends wget ca-certificates \
&& echo "no" | dpkg-reconfigure dash \
&& rm -rf /var/lib/apt/lists/*

ARG DOWNLOAD_URL=https://download.jumpserver.org
ARG PLAY_VERSION=1.1.0-1

WORKDIR /opt/player
RUN set -ex \
&& wget -q ${DOWNLOAD_URL}/public/glyptodon-enterprise-player-${PLAY_VERSION}.tar.gz \
&& tar -xf glyptodon-enterprise-player-${PLAY_VERSION}.tar.gz -C /opt/player --strip-components 1 \
&& rm -f glyptodon-enterprise-player-${PLAY_VERSION}.tar.gz

WORKDIR /opt/download/applets

ARG PYTHON_VERSION=3.11.6
RUN set -ex \
&& wget -q https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-amd64.exe

ARG CHROME_VERSION=118.0.5993.118
ARG CHROME_DRIVER_VERSION=118.0.5993.70
RUN set -ex \
&& wget -q https://github.com/jumpserver-dev/Chrome-Portable-Win64/releases/download/${CHROME_DRIVER_VERSION}/chromedriver-win64.zip \
&& wget -q https://github.com/jumpserver-dev/Chrome-Portable-Win64/releases/download/${CHROME_VERSION}/chrome-win.zip

ARG DBEAVER_VERSION=22.3.4
RUN set -ex \
&& wget -q https://dbeaver.io/files/${DBEAVER_VERSION}/dbeaver-ce-${DBEAVER_VERSION}-x86_64-setup.exe \
&& wget -qO dbeaver-patch.msi ${DOWNLOAD_URL}/public/dbeaver-patch-${DBEAVER_VERSION}-x86_64-setup.msi

ARG TINKER_VERSION=v0.1.5
RUN set -ex \
&& wget -qO Tinker_Installer.exe ${DOWNLOAD_URL}/public/Tinker_Installer_${TINKER_VERSION}.exe

WORKDIR /opt/download/public
ARG MRD_VERSION=10.6.7
RUN set -ex \
&& wget -q ${DOWNLOAD_URL}/public/Microsoft_Remote_Desktop_${MRD_VERSION}_installer.pkg

ARG VIDEO_PLAYER_VERSION=0.1.9
RUN set -ex \
&& wget -qO JumpServer-Video-Player.dmg https://github.com/jumpserver/VideoPlayer/releases/download/v0.1.9/JumpServer.Video.Player-${VIDEO_PLAYER_VERSION}.dmg \
&& wget -qO JumpServer-Video-Player.exe https://github.com/jumpserver/VideoPlayer/releases/download/v0.1.9/JumpServer.Video.Player.Setup.${VIDEO_PLAYER_VERSION}.exe

ARG OPENSSH_VERSION=v9.4.0.0
RUN set -ex \
&& wget -qO OpenSSH-Win64.msi https://github.com/PowerShell/Win32-OpenSSH/releases/download/${OPENSSH_VERSION}p1-Beta/OpenSSH-Win64-${OPENSSH_VERSION}.msi

ARG Client_VERSION=v2.1.2
RUN set -ex \
&& wget -qO JumpServer-Client-Installer-x86_64.msi https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-win-${Client_VERSION}-x64.msi \
&& wget -qO JumpServer-Client-Installer-x86_64.exe https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-win-${Client_VERSION}-x64.exe \
&& wget -qO JumpServer-Client-Installer-amd64.dmg https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-mac-${Client_VERSION}-x64.dmg \
&& wget -qO JumpServer-Client-Installer-arm64.dmg https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-mac-${Client_VERSION}-arm64.dmg \
&& wget -qO JumpServer-Client-Installer-amd64.deb https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-linux-${Client_VERSION}-amd64.deb \
&& wget -qO JumpServer-Client-Installer-arm64.deb https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-linux-${Client_VERSION}-arm64.deb
COPY opt /opt
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ JumpServer Web 项目,包含一些静态安装包文件
## Docker 构建

```bash
VERSION=dev
docker buildx build --build-arg VERSION=${VERSION} -t jumpserver/web-static:${VERSION} . --load
VERSION=$(cat VERSION)
./prepare.sh
docker buildx build -t jumpserver/web-static:${VERSION} . --load
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.9
v1.1.0
47 changes: 47 additions & 0 deletions prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
set -ex

PLAY_VERSION=1.1.0-1
PYTHON_VERSION=3.11.6
CHROME_VERSION=118.0.5993.118
CHROME_DRIVER_VERSION=118.0.5993.70
DBEAVER_VERSION=22.3.4
TINKER_VERSION=v0.1.5
MRD_VERSION=10.6.7
VIDEO_PLAYER_VERSION=0.1.9
OPENSSH_VERSION=v9.4.0.0
Client_VERSION=v2.1.2

DOWNLOAD_URL=https://download.jumpserver.org

PROJECT_DIR=$(cd `dirname $0`; pwd)
cd ${PROJECT_DIR} || exit 1

mkdir -p ${PROJECT_DIR}/opt/player
cd ${PROJECT_DIR}/opt/player
wget -q ${DOWNLOAD_URL}/public/glyptodon-enterprise-player-${PLAY_VERSION}.tar.gz
tar -xf glyptodon-enterprise-player-${PLAY_VERSION}.tar.gz -C /opt/player --strip-components 1
rm -f glyptodon-enterprise-player-${PLAY_VERSION}.tar.gz

mkdir -p ${PROJECT_DIR}/opt/download/applets
cd ${PROJECT_DIR}/opt/download/applets
wget -q https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-amd64.exe
wget -q https://github.com/jumpserver-dev/Chrome-Portable-Win64/releases/download/${CHROME_DRIVER_VERSION}/chromedriver-win64.zip
wget -q https://github.com/jumpserver-dev/Chrome-Portable-Win64/releases/download/${CHROME_VERSION}/chrome-win.zip
wget -q https://dbeaver.io/files/${DBEAVER_VERSION}/dbeaver-ce-${DBEAVER_VERSION}-x86_64-setup.exe
wget -qO dbeaver-patch.msi ${DOWNLOAD_URL}/public/dbeaver-patch-${DBEAVER_VERSION}-x86_64-setup.msi
wget -qO Tinker_Installer.exe ${DOWNLOAD_URL}/public/Tinker_Installer_${TINKER_VERSION}.exe

mkdir -p ${PROJECT_DIR}/opt/download/public
cd ${PROJECT_DIR}/opt/download/public
wget -q ${DOWNLOAD_URL}/public/Microsoft_Remote_Desktop_${MRD_VERSION}_installer.pkg
wget -qO JumpServer-Video-Player.dmg https://github.com/jumpserver/VideoPlayer/releases/download/v0.1.9/JumpServer.Video.Player-${VIDEO_PLAYER_VERSION}.dmg
wget -qO JumpServer-Video-Player.exe https://github.com/jumpserver/VideoPlayer/releases/download/v0.1.9/JumpServer.Video.Player.Setup.${VIDEO_PLAYER_VERSION}.exe
wget -qO OpenSSH-Win64.msi https://github.com/PowerShell/Win32-OpenSSH/releases/download/${OPENSSH_VERSION}p1-Beta/OpenSSH-Win64-${OPENSSH_VERSION}.msi
wget -qO JumpServer-Client-Installer-x86_64.msi https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-win-${Client_VERSION}-x64.msi
wget -qO JumpServer-Client-Installer-x86_64.exe https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-win-${Client_VERSION}-x64.exe
wget -qO JumpServer-Client-Installer-amd64.dmg https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-mac-${Client_VERSION}-x64.dmg
wget -qO JumpServer-Client-Installer-arm64.dmg https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-mac-${Client_VERSION}-arm64.dmg
wget -qO JumpServer-Client-Installer-amd64.deb https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-linux-${Client_VERSION}-amd64.deb
wget -qO JumpServer-Client-Installer-arm64.deb https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-linux-${Client_VERSION}-arm64.deb

0 comments on commit 3dfaf91

Please sign in to comment.