feat: put atest-collector into the image (#87)
* feat: put atest-collector into the image * doc: add instructions about how to use in Docker
This commit is contained in:
parent
ec32ff386c
commit
1fd4586712
|
@ -4,6 +4,8 @@ on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- '*'
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
|
|
|
@ -3,15 +3,19 @@ FROM golang:1.18 AS builder
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
COPY cmd/ cmd/
|
COPY cmd/ cmd/
|
||||||
COPY pkg/ pkg/
|
COPY pkg/ pkg/
|
||||||
|
COPY extensions/ extensions/
|
||||||
COPY sample/ sample/
|
COPY sample/ sample/
|
||||||
COPY go.mod go.mod
|
COPY go.mod go.mod
|
||||||
COPY go.sum go.sum
|
COPY go.sum go.sum
|
||||||
|
COPY go.work go.work
|
||||||
|
COPY go.work.sum go.work.sum
|
||||||
COPY main.go main.go
|
COPY main.go main.go
|
||||||
COPY README.md README.md
|
COPY README.md README.md
|
||||||
COPY LICENSE LICENSE
|
COPY LICENSE LICENSE
|
||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
RUN CGO_ENABLE=0 go build -ldflags "-w -s" -o atest .
|
RUN CGO_ENABLE=0 go build -ldflags "-w -s" -o atest .
|
||||||
|
RUN CGO_ENABLE=0 go build -ldflags "-w -s" -o atest-collector extensions/collector/main.go
|
||||||
|
|
||||||
FROM ubuntu:23.04
|
FROM ubuntu:23.04
|
||||||
|
|
||||||
|
@ -27,6 +31,7 @@ LABEL "maintainer"="Rick <linuxsuren@gmail.com>"
|
||||||
LABEL "Name"="API testing"
|
LABEL "Name"="API testing"
|
||||||
|
|
||||||
COPY --from=builder /workspace/atest /usr/local/bin/atest
|
COPY --from=builder /workspace/atest /usr/local/bin/atest
|
||||||
|
COPY --from=builder /workspace/atest-collector /usr/local/bin/atest-collector
|
||||||
COPY --from=builder /workspace/LICENSE /LICENSE
|
COPY --from=builder /workspace/LICENSE /LICENSE
|
||||||
COPY --from=builder /workspace/README.md /README.md
|
COPY --from=builder /workspace/README.md /README.md
|
||||||
|
|
||||||
|
|
17
README.md
17
README.md
|
@ -61,6 +61,23 @@ below is an example of the usage, and you could see the report as well:
|
||||||
| GET https://gitlab.com/api/v4/projects/45088772 | 840.761064ms | 1.487285371s | 492.583066ms | 10 | 0 |
|
| GET https://gitlab.com/api/v4/projects/45088772 | 840.761064ms | 1.487285371s | 492.583066ms | 10 | 0 |
|
||||||
consume: 1m2.153686448s
|
consume: 1m2.153686448s
|
||||||
|
|
||||||
|
## Use in Docker
|
||||||
|
|
||||||
|
Use `atest` as server mode in Docker:
|
||||||
|
```
|
||||||
|
docker run -p 7070:7070 ghcr.io/linuxsuren/api-testing
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `atest-collector` in Docker:
|
||||||
|
```shell
|
||||||
|
docker run -p 1234:8080 -v /var/tmp:/var/tmp \
|
||||||
|
ghcr.io/linuxsuren/api-testing atest-collector \
|
||||||
|
--filter-path /api \
|
||||||
|
-o /var/tmp/sample.yaml
|
||||||
|
# you could find the test cases file from /var/tmp/sample
|
||||||
|
# cat /var/tmp/sample
|
||||||
|
```
|
||||||
|
|
||||||
## Template
|
## Template
|
||||||
|
|
||||||
The following fields are templated with [sprig](http://masterminds.github.io/sprig/):
|
The following fields are templated with [sprig](http://masterminds.github.io/sprig/):
|
||||||
|
|
Loading…
Reference in New Issue