Skip to content

Commit

Permalink
Merge pull request #142 from jumpserver/pr@dev@perf_buildx
Browse files Browse the repository at this point in the history
perf: 优化构建
  • Loading branch information
ibuler authored Oct 25, 2023
2 parents 21a0562 + 89b9d14 commit fbe0492
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 76 deletions.
77 changes: 9 additions & 68 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,67 +1,8 @@
FROM nginx:1.24-bullseye as builder
ARG TARGETARCH

ARG APT_MIRROR=http://mirrors.ustc.edu.cn
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=web \
sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
&& rm -f /etc/cron.daily/apt-compat \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& apt-get update \
&& apt-get install -y --no-install-recommends wget \
&& 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=114.0.5735.134
RUN set -ex \
&& wget -q https://github.com/wojiushixiaobai/Chrome-Portable-Win64/releases/download/${CHROME_VERSION}/chromedriver_win32.zip \
&& wget -q https://github.com/wojiushixiaobai/Chrome-Portable-Win64/releases/download/${CHROME_VERSION}/chrome-win.zip

ARG DBEAVER_VERSION=22.3.4
RUN set -ex \
&& wget -q ${DOWNLOAD_URL}/public/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.3
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.0.2
RUN set -ex \
&& wget -qO JumpServer-Client-Installer-x86_64.msi https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-${Client_VERSION}-x86_64.msi \
&& wget -qO JumpServer-Client-Installer-x86_64.exe https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-${Client_VERSION}-x86_64.exe \
&& wget -qO JumpServer-Client-Installer-amd64.dmg https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-${Client_VERSION}-amd64.dmg \
&& wget -qO JumpServer-Client-Installer-arm64.dmg https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-${Client_VERSION}-arm64.dmg \
&& wget -qO JumpServer-Client-Installer-amd64.deb https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-${Client_VERSION}-amd64.deb \
&& wget -qO JumpServer-Client-Installer-arm64.deb https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-${Client_VERSION}-arm64.deb
ARG VERSION
FROM registry.fit2cloud.com/jumpserver/web-static:v1.0.0 as static
FROM registry.fit2cloud.com/jumpserver/lina:${VERSION} as lina
FROM registry.fit2cloud.com/jumpserver/luna:${VERSION} as luna
FROM registry.fit2cloud.com/jumpserver/applets:${VERSION} as applets

FROM nginx:1.24-bullseye
ARG TARGETARCH
Expand All @@ -80,10 +21,10 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=web \

WORKDIR /opt

COPY --from=builder /opt /opt
COPY release/lina /opt/lina
COPY release/luna /opt/luna
COPY release/applets /opt/download/applets
COPY --from=static /opt /opt
COPY --from=lina /opt/lina /opt/lina
COPY --from=luna /opt/luna /opt/luna
COPY --from=applets /opt/applets /opt/download/applets
COPY nginx.conf /etc/nginx/nginx.conf
COPY includes /etc/nginx/includes
COPY default.conf /etc/nginx/conf.d/default.conf
Expand Down
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@
JumpServer 的 LB Nginx Build 项目,其中包含 Lina, Luna 和一些静态安装包文件

## Docker 构建

```bash
VERSION=dev
docker run --rm -i -v $(pwd)/release:/tmp/data jumpserver/lina:${VERSION} cp -R /opt/lina /tmp/data
docker run --rm -i -v $(pwd)/release:/tmp/data jumpserver/luna:${VERSION} cp -R /opt/luna /tmp/data
docker run --rm -i -v $(pwd)/release:/tmp/data jumpserver/applets:${VERSION} cp -R /opt/applets /tmp/data
```
```bash
ls -al release
```
```bash
docker buildx build --build-arg VERSION=${VERSION} -t jumpserver/web:${VERSION} . --load
```

0 comments on commit fbe0492

Please sign in to comment.