Skip to content

Commit

Permalink
Merge pull request #5
Browse files Browse the repository at this point in the history
chore: add dockerfile debian source args; add usage img
  • Loading branch information
lihuacai168 authored May 5, 2023
2 parents 6cd2c94 + 22a76bd commit ceb8512
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 17 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
**/*.log
**/*-log-*
**/*.tar.gz
Dockerfile
.dockerignore
*.md
.github
docs/
30 changes: 18 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@

# 使用官方Python 3.9镜像作为基础镜像
FROM python:3.9-buster

# 设置环境变量
ENV JMETER_VERSION 5.5
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}
ENV PATH ${JMETER_HOME}/bin:${PATH}

# 更换apt源为阿里云镜像源,更新系统和安装一些基本软件包
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
apt-get update && \
ARG DEBIAN_REPO="deb.debian.org"


ARG DEBIAN_REPO="deb.debian.org"
ARG PIP_INDEX_URL="https://pypi.org/simple"

# replace sources.list, if use docker-compose
RUN echo "deb http://$DEBIAN_REPO/debian/ buster main contrib non-free" > /etc/apt/sources.list && \
echo "deb-src http://$DEBIAN_REPO/debian/ buster main contrib non-free" >> /etc/apt/sources.list && \
echo "deb http://$DEBIAN_REPO/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb-src http://$DEBIAN_REPO/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb http://$DEBIAN_REPO/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb-src http://$DEBIAN_REPO/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list

# update apt-get and install packages
RUN apt-get update && \
apt-get install -y wget unzip openjdk-11-jdk ant

# 安装JMeter
# install JMeter
RUN wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz && \
tar -xzf apache-jmeter-${JMETER_VERSION}.tgz -C /opt && \
rm apache-jmeter-${JMETER_VERSION}.tgz && \
chmod +x ${JMETER_HOME}/bin/jmeter

ARG PIP_INDEX_URL="https://pypi.org/simple"

# 安装项目依赖
# install python packages
COPY requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt -i ${PIP_INDEX_URL}

# 设置工作目录
WORKDIR /app

# 将项目文件拷贝到工作目录
COPY . .

# 暴露8000端口
EXPOSE 8000

# 启动FastAPI应用
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Jmeter-Toolkit 支持 JMX 文件的上传、执行、查看JMX、查看JTL以及
- [x] **jmx文件查看**
- [x] **jtl文件查看**
- [x] **html报告生成**
- [ ] **合并jmx上传执行查看报告**
- [x] **合并jmx上传执行查看报告**
- [ ] **jtl文件上传**
- [ ] **jmx文件下载**
- [ ] **jtl文件下载**
Expand All @@ -19,6 +19,12 @@ Jmeter-Toolkit 支持 JMX 文件的上传、执行、查看JMX、查看JTL以及
- [ ] **分布式执行**
- [ ] **使用数据库管理文件**


# 使用演示
## 1. 上传JMX文件并执行
![upload-execute.png](docs%2Fupload-execute.png)
## 2. 查看报告
![report.png](docs%2Freport.png)
# 快速启动
## 1. 安装 Docker
请参考 [Docker 官方文档](https://docs.docker.com/engine/install/) 安装 Docker。
Expand Down Expand Up @@ -49,10 +55,6 @@ make up
http://localhost:18000/docs


# 使用步骤
1. 上传 JMX 文件
2. 执行 JMX 文件 得到 JTL 文件夹
3. 使用 JTL 文件生成 HTML 报告


# Contributors
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
context: .
dockerfile: Dockerfile
args:
DEBIAN_REPO: ${DEBIAN_REPO:-mirrors.aliyun.com}
PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.tuna.tsinghua.edu.cn/simple}
ports:
- "18000:8000"
Expand Down
Binary file added docs/report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/upload-execute.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ceb8512

Please sign in to comment.