Skip to content

Commit 3244947

Browse files
authored
Merge pull request #42 from jumpserver/dev
v4.0.0
2 parents 27db40e + a1609c9 commit 3244947

2 files changed

Lines changed: 46 additions & 33 deletions

File tree

.github/workflows/jms-build-test.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
11
name: "Run Build Test"
22
on:
33
push:
4-
branches:
5-
- pr@*
6-
- repr@*
4+
paths:
5+
- 'Dockerfile'
6+
- 'Dockerfile*'
7+
- 'requirements.txt'
78

89
jobs:
910
build:
1011
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
component: [applets]
15+
version: [v4]
1116
steps:
12-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
18+
- uses: docker/setup-buildx-action@v3
1319

14-
- uses: docker/setup-qemu-action@v2
15-
16-
- uses: docker/setup-buildx-action@v2
20+
- name: Login to GitHub Container Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.repository_owner }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
1726

18-
- uses: docker/build-push-action@v3
27+
- name: Build Image
28+
uses: docker/build-push-action@v5
1929
with:
2030
context: .
21-
push: false
22-
tags: jumpserver/applets:test
31+
push: true
32+
file: Dockerfile
33+
tags: ghcr.io/jumpserver/${{ matrix.component }}:${{ matrix.version }}
34+
platforms: linux/amd64
2335
build-args: |
36+
VERSION=${{ matrix.version }}
2437
APT_MIRROR=http://deb.debian.org
2538
PIP_MIRROR=https://pypi.org/simple
26-
file: Dockerfile
39+
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
2740
cache-from: type=gha
2841
cache-to: type=gha,mode=max
29-
30-
- uses: LouisBrunner/checks-action@v1.5.0
31-
if: always()
32-
with:
33-
token: ${{ secrets.GITHUB_TOKEN }}
34-
name: Check Build
35-
conclusion: ${{ job.status }}

Dockerfile

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
FROM python:3.11-slim-bullseye as stage-build
22
ARG TARGETARCH
3-
ARG PIP_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple
4-
ARG APT_MIRROR=http://mirrors.ustc.edu.cn
53

6-
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=applets \
7-
sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
8-
&& rm -f /etc/cron.daily/apt-compat \
9-
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
4+
ARG DEPENDENCIES=" \
5+
ca-certificates \
6+
curl \
7+
wget \
8+
zip"
9+
10+
ARG APT_MIRROR=http://mirrors.ustc.edu.cn
11+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
12+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
13+
set -ex \
14+
&& rm -f /etc/apt/apt.conf.d/docker-clean \
15+
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache \
16+
&& sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
1017
&& apt-get update \
11-
&& apt-get install -y --no-install-recommends wget zip \
12-
&& echo "no" | dpkg-reconfigure dash \
13-
&& rm -rf /var/lib/apt/lists/*
18+
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
19+
&& echo "no" | dpkg-reconfigure dash
1420

1521
WORKDIR /opt/applets
16-
COPY requirements.txt requirements.txt
1722

18-
RUN --mount=type=cache,target=/root/.cache/pip \
23+
ARG PIP_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple
24+
RUN --mount=type=cache,target=/root/.cache,sharing=locked,id=applets \
25+
--mount=type=bind,source=requirements.txt,target=requirements.txt \
1926
set -ex \
2027
&& mkdir pip_packages build \
2128
&& pip config set global.index-url ${PIP_MIRROR} \
22-
&& pip download --only-binary=:all: \
23-
-d pip_packages \
24-
--platform win_amd64 \
25-
--python-version 3.11.6 --abi cp311 -r requirements.txt -i${PIP_MIRROR} \
29+
&& pip download \
30+
--only-binary=:all: --platform win_amd64 \
31+
--python-version 3.11.6 --abi cp311 \
32+
-d pip_packages -r requirements.txt -i${PIP_MIRROR} \
2633
&& cp requirements.txt pip_packages \
2734
&& zip -r pip_packages.zip pip_packages \
2835
&& mv pip_packages.zip build

0 commit comments

Comments
 (0)