Skip to content

Commit

Permalink
Merge pull request #148 from jumpserver/dev
Browse files Browse the repository at this point in the history
v3.6.0
  • Loading branch information
BaiJiangJie authored Aug 17, 2023
2 parents 60837de + 9ee7f98 commit 17660c3
Show file tree
Hide file tree
Showing 128 changed files with 3,912 additions and 13,389 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
.DS_Store
.config.yml
.vscode
data
script.go
config.yml
88 changes: 51 additions & 37 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.19-buster as stage-wisp-build
ARG TARGETARCH
ARG GOPROXY=https://goproxy.io
ARG WISP_VERSION=v0.1.11
ARG WISP_VERSION=v0.1.15
ENV GO111MODULE=on
ENV CGO_ENABLED=0

Expand All @@ -27,15 +27,52 @@ ADD ui .
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=kael \
yarn build

FROM jumpserver/python:3.10-slim-buster
FROM golang:1.20-buster as kael-build
ARG TARGETARCH

WORKDIR /opt/kael

ADD go.mod go.sum .

ARG GOPROXY=https://goproxy.io
ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOOS=linux

RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
go mod download -x

COPY . .

ARG VERSION
ENV VERSION=$VERSION

RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
set +x \
&& export GOFlAGS="-X 'main.Buildstamp=`date -u '+%Y-%m-%d %I:%M:%S%p'`'" \
&& export GOFlAGS="$GOFlAGS -X 'main.Githash=`git rev-parse HEAD`'" \
&& export GOFlAGS="${GOFlAGS} -X 'main.Goversion=`go version`'" \
&& export GOFlAGS="$GOFlAGS -X 'main.Version=$VERSION'" \
&& go build -ldflags "$GOFlAGS" -o kael ./cmd/kael \
&& set -x && ls -al .

RUN mkdir /opt/kael/release \
&& mv /opt/kael/entrypoint.sh /opt/kael/release


FROM debian:bullseye-slim
ARG TARGETARCH

ARG DEPENDENCIES=" \
ca-certificates \
curl \
libssl-dev \
locales \
vim"
curl \
git \
net-tools \
unzip \
vim \
locales \
wget"

ARG APT_MIRROR=http://mirrors.ustc.edu.cn

Expand All @@ -44,49 +81,26 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=kael \
&& rm -f /etc/apt/apt.conf.d/docker-clean \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& apt-get update \
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
&& mkdir -p /root/.ssh/ \
&& echo "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile /dev/null" > /root/.ssh/config \
&& echo "set mouse-=a" > ~/.vimrc \
&& apt-get install -y --no-install-recommends ${DEPENDENCIES} \
&& apt-get update \
&& echo "no" | dpkg-reconfigure dash \
&& echo "zh_CN.UTF-8" | dpkg-reconfigure locales \
&& sed -i "s@# export @export @g" ~/.bashrc \
&& sed -i "s@# alias @alias @g" ~/.bashrc \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /tmp/build
COPY ./app/requirements.txt ./requirements/requirements.txt

ARG PIP_MIRROR=https://pypi.douban.com/simple

RUN --mount=type=cache,target=/root/.cache/pip \
set -ex \
&& pip config set global.index-url ${PIP_MIRROR} \
&& pip install --upgrade pip \
&& pip install --upgrade setuptools wheel \
&& \
if [ "${TARGETARCH}" == "loong64" ]; then \
pip install https://download.jumpserver.org/pypi/simple/grpcio/grpcio-1.56.0-cp310-cp310-linux_loongarch64.whl; \
fi \
&& pip install -r requirements/requirements.txt
WORKDIR /opt/kael/

WORKDIR /opt/kael

COPY app .
COPY --from=ui-build /opt/kael/ui/dist ./ui
COPY --from=ui-build /opt/kael/ui/dist ./ui/dist
COPY --from=stage-wisp-build /go/bin/wisp /usr/local/bin/wisp
COPY --from=kael-build /opt/kael/kael .
COPY --from=kael-build /opt/kael/release .

RUN chmod +x ./entrypoint.sh

ARG VERSION
ENV VERSION=$VERSION

ENV LANG=zh_CN.UTF-8

ENV WORK_DIR=/opt/kael
ENV COMPONENT_NAME=kael
ENV EXECUTE_PROGRAM="uvicorn main:app --host 0.0.0.0 --port 8083"
ENV EXECUTE_PROGRAM="/opt/kael/kael"

EXPOSE 8083

CMD ["./entrypoint.sh"]
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Kael 前端 vue3,后端使用 Fastapi 实现, 名字来源 [Kael](https://ww
- [ ] Bard


## UI 展示

![UI展示](https://download.jumpserver.org/images/kael.png)


## 开发环境

1.下载项目
Expand All @@ -23,26 +28,26 @@ $ git clone https://github.com/jumpserver/kael.git
```

2.安装依赖
```agsl
```shell
$ cd app
$ pip install -r requirements.txt
$ cd ../ui
$ npm install
```
3.运行 API

```agsl
```shell
$ cd app
$ cp config_example.yml config.yml
$ vim config.yml # 修改配置文件中的各个 key
$ vim config.yml $ 修改配置文件中的各个 key
$ python main.py
```

4.运行 UI

```agsl
```shell
$ cd ui
$ cp .env.development .env
$ vim .env # 修改 VITE_APP_BASE_URL
$ vim .env $ 修改 VITE_APP_BASE_URL
$ npm run serve
```
29 changes: 0 additions & 29 deletions app/.gitignore

This file was deleted.

Empty file removed app/api/__init__.py
Empty file.
1 change: 0 additions & 1 deletion app/api/ai/__init__.py

This file was deleted.

116 changes: 0 additions & 116 deletions app/api/ai/chat_gpt.py

This file was deleted.

1 change: 0 additions & 1 deletion app/api/conf/__init__.py

This file was deleted.

44 changes: 0 additions & 44 deletions app/api/conf/base.py

This file was deleted.

Loading

0 comments on commit 17660c3

Please sign in to comment.