Skip to content

Commit 1fd4586

Browse files
authored
feat: put atest-collector into the image (#87)
* feat: put atest-collector into the image * doc: add instructions about how to use in Docker
1 parent ec32ff3 commit 1fd4586

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.github/workflows/release.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
tags:
66
- '*'
7+
branches:
8+
- master
79

810
env:
911
REGISTRY: ghcr.io

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ FROM golang:1.18 AS builder
33
WORKDIR /workspace
44
COPY cmd/ cmd/
55
COPY pkg/ pkg/
6+
COPY extensions/ extensions/
67
COPY sample/ sample/
78
COPY go.mod go.mod
89
COPY go.sum go.sum
10+
COPY go.work go.work
11+
COPY go.work.sum go.work.sum
912
COPY main.go main.go
1013
COPY README.md README.md
1114
COPY LICENSE LICENSE
1215

1316
RUN go mod download
1417
RUN CGO_ENABLE=0 go build -ldflags "-w -s" -o atest .
18+
RUN CGO_ENABLE=0 go build -ldflags "-w -s" -o atest-collector extensions/collector/main.go
1519

1620
FROM ubuntu:23.04
1721

@@ -27,6 +31,7 @@ LABEL "maintainer"="Rick <[email protected]>"
2731
LABEL "Name"="API testing"
2832

2933
COPY --from=builder /workspace/atest /usr/local/bin/atest
34+
COPY --from=builder /workspace/atest-collector /usr/local/bin/atest-collector
3035
COPY --from=builder /workspace/LICENSE /LICENSE
3136
COPY --from=builder /workspace/README.md /README.md
3237

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,23 @@ below is an example of the usage, and you could see the report as well:
6161
| GET https://gitlab.com/api/v4/projects/45088772 | 840.761064ms | 1.487285371s | 492.583066ms | 10 | 0 |
6262
consume: 1m2.153686448s
6363
64+
## Use in Docker
65+
66+
Use `atest` as server mode in Docker:
67+
```
68+
docker run -p 7070:7070 ghcr.io/linuxsuren/api-testing
69+
```
70+
71+
Use `atest-collector` in Docker:
72+
```shell
73+
docker run -p 1234:8080 -v /var/tmp:/var/tmp \
74+
ghcr.io/linuxsuren/api-testing atest-collector \
75+
--filter-path /api \
76+
-o /var/tmp/sample.yaml
77+
# you could find the test cases file from /var/tmp/sample
78+
# cat /var/tmp/sample
79+
```
80+
6481
## Template
6582
6683
The following fields are templated with [sprig](http://masterminds.github.io/sprig/):

0 commit comments

Comments
 (0)