diff --git a/Dockerfile b/Dockerfile index e8f3a71..fda5d1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/prepare.sh b/prepare.sh index b1296dd..939cead 100755 --- a/prepare.sh +++ b/prepare.sh @@ -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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4b255ce --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +pywinauto==0.6.6 +selenium==4.4.0 +pywin32==304 +PyYAML==6.0 +cffi==1.16.0 diff --git a/versions.txt b/versions.txt index 1948eb8..0f24581 100644 --- a/versions.txt +++ b/versions.txt @@ -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