diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 31f3e427..8c953b87 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,6 +4,8 @@ on: push: tags: - '*' + branches: + - master env: REGISTRY: ghcr.io diff --git a/Dockerfile b/Dockerfile index f0e9d5df..c0e56604 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -27,6 +31,7 @@ LABEL "maintainer"="Rick " 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 diff --git a/README.md b/README.md index c6cb33a9..657599fb 100644 --- a/README.md +++ b/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 | 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/):