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

Commit

Permalink
perf: move applets to self
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuler committed Jul 25, 2024
1 parent 40c65c8 commit c7146fb
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 9 deletions.
43 changes: 40 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
FROM alpine:3.20.1
FROM python:3.11-slim-bullseye AS stage-build
ARG TARGETARCH

WORKDIR /tmp
ARG DEPENDENCIES=" \
ca-certificates \
curl \
wget \
zip"

COPY . .
ARG APT_MIRROR=http://deb.debian.org
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} \
&& apt-get clean all \
&& echo "no" | dpkg-reconfigure dash

WORKDIR /opt/applets

COPY requirements.txt ./requirements.txt

ARG PIP_MIRROR=https://pypi.org/simple
RUN set -ex \
&& mkdir pip_packages build \
&& pip config set global.index-url ${PIP_MIRROR} \
&& pip download \
--only-binary=:all: --platform win_amd64 \
--python-version 3.11.6 --abi cp311 \
-d pip_packages -r requirements.txt -i${PIP_MIRROR} \
&& cp requirements.txt pip_packages \
&& zip -r pip_packages.zip pip_packages \
&& mv pip_packages.zip build


FROM alpine:3.20

COPY . .
RUN set -ex \
&& apk add --no-cache bash \
&& bash ./prepare.sh

COPY --from=stage-build /opt/applets/build /opt/applets
11 changes: 6 additions & 5 deletions prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ wget ${DOWNLOAD_URL}/public/Tinker_Installer_${TINKER_VERSION}.exe
mkdir -p ${DOWNLOAD_DIR}/public
cd ${DOWNLOAD_DIR}/public || exit 1
wget ${DOWNLOAD_URL}/public/Microsoft_Remote_Desktop_${MRD_VERSION}_installer.pkg
wget https://github.com/jumpserver/VideoPlayer/releases/download/v0.1.9/JumpServer.Video.Player-${VIDEO_PLAYER_VERSION}.dmg
wget https://github.com/jumpserver/VideoPlayer/releases/download/v0.1.9/JumpServer.Video.Player.Setup.${VIDEO_PLAYER_VERSION}.exe
wget https://github.com/jumpserver/VideoPlayer/releases/download/${VIDEO_PLAYER_VERSION}/JumpServer.Video.Player-${VIDEO_PLAYER_VERSION}.dmg
wget https://github.com/jumpserver/VideoPlayer/releases/download/${VIDEO_PLAYER_VERSION}/JumpServer.Video.Player.Setup.${VIDEO_PLAYER_VERSION}.exe

wget https://github.com/PowerShell/Win32-OpenSSH/releases/download/${OPENSSH_VERSION}p1-Beta/OpenSSH-Win64-${OPENSSH_VERSION}.msi

clients=("win-${Client_VERSION}-x64.exe" "mac-${Client_VERSION}-x64.dmg" "mac-${Client_VERSION}-arm64.dmg"
"linux-${Client_VERSION}-amd64.deb" "linux-${Client_VERSION}-arm64.deb")
clients=("win-${CLIENT_VERSION}-x64.exe" "mac-${CLIENT_VERSION}-x64.dmg" "mac-${CLIENT_VERSION}-arm64.dmg"
"linux-${CLIENT_VERSION}-amd64.deb" "linux-${CLIENT_VERSION}-arm64.deb")
for client in "${clients[@]}"; do
wget "https://github.com/jumpserver/clients/releases/download/${Client_VERSION}/JumpServer-Client-Installer-${client}"
wget "https://github.com/jumpserver/clients/releases/download/${CLIENT_VERSION}/JumpServer-Client-Installer-${client}"
done

for arch in x64 arm64; do
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pywinauto==0.6.6
selenium==4.4.0
pywin32==304
PyYAML==6.0
cffi==1.16.0
2 changes: 1 addition & 1 deletion versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ OPENSSH_VERSION=v9.4.0.0
MONGOSH_VERSION=2.2.12
TINKER_VERSION=v0.1.6
VIDEO_PLAYER_VERSION=0.1.9
Client_VERSION=v2.1.3
CLIENT_VERSION=v2.1.3

0 comments on commit c7146fb

Please sign in to comment.