Skip to content

Commit

Permalink
feat: put atest-collector into the image (#87)
Browse files Browse the repository at this point in the history
* feat: put atest-collector into the image

* doc: add instructions about how to use in Docker
  • Loading branch information
LinuxSuRen authored Jun 8, 2023
1 parent ec32ff3 commit 1fd4586
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- '*'
branches:
- master

env:
REGISTRY: ghcr.io
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ FROM golang:1.18 AS builder
WORKDIR /workspace
COPY cmd/ cmd/
COPY pkg/ pkg/
COPY extensions/ extensions/
COPY sample/ sample/
COPY go.mod go.mod
COPY go.sum go.sum
COPY go.work go.work
COPY go.work.sum go.work.sum
COPY main.go main.go
COPY README.md README.md
COPY LICENSE LICENSE

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-collector extensions/collector/main.go

FROM ubuntu:23.04

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

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/README.md /README.md

Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
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
The following fields are templated with [sprig](http://masterminds.github.io/sprig/):
Expand Down

0 comments on commit 1fd4586

Please sign in to comment.