@@ -11,16 +11,20 @@ A reasonably complete and well-tested golang port of [Kenneth Reitz][kr]'s
11
11
12
12
## Usage
13
13
14
- ### Docker
14
+ ### Docker/OCI images
15
15
16
- Docker images are published to [ Docker Hub] [ docker-hub ] :
16
+ Prebuilt images for the ` linux/amd64 ` and ` linux/arm64 ` architectures are
17
+ automatically published to these public registries for every tagged release:
18
+ - GitHub Container Registry: [ ghcr.io/mccutchen/go-httpbin] [ ghcr ]
19
+ - ** Note:** Only version ` 2.17 ` and later
20
+ - Docker Hub: [ mccutchen/go-httpbin] [ docker-hub ]
17
21
18
22
``` bash
19
23
# Run http server
20
- $ docker run -P mccutchen/go-httpbin
24
+ $ docker run -P ghcr.io/ mccutchen/go-httpbin
21
25
22
26
# Run https server
23
- $ docker run -e HTTPS_CERT_FILE=' /tmp/server.crt' -e HTTPS_KEY_FILE=' /tmp/server.key' -p 8080:8080 -v /tmp:/tmp mccutchen/go-httpbin
27
+ $ docker run -e HTTPS_CERT_FILE=' /tmp/server.crt' -e HTTPS_KEY_FILE=' /tmp/server.key' -p 8080:8080 -v /tmp:/tmp ghcr.io/ mccutchen/go-httpbin
24
28
```
25
29
26
30
### Kubernetes
@@ -34,19 +38,19 @@ See `./kustomize` directory for further information
34
38
### Standalone binary
35
39
36
40
Follow the [ Installation] ( #installation ) instructions to install go-httpbin as
37
- a standalone binary. (This currently requires a working Go runtime.)
41
+ a standalone binary, or use ` go run ` to install it on demand:
38
42
39
43
Examples:
40
44
41
45
``` bash
42
46
# Run http server
43
- $ go-httpbin -host 127.0.0.1 -port 8081
47
+ $ go run github.com/mccutchen/go -httpbin/v2/cmd/go-httpbin@latest -host 127.0.0.1 -port 8081
44
48
45
49
# Run https server
46
50
$ openssl genrsa -out server.key 2048
47
51
$ openssl ecparam -genkey -name secp384r1 -out server.key
48
52
$ openssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650
49
- $ go-httpbin -host 127.0.0.1 -port 8081 -https-cert-file ./server.crt -https-key-file ./server.key
53
+ $ go run github.com/mccutchen/go -httpbin/v2/cmd/go-httpbin@latest -host 127.0.0.1 -port 8081 -https-cert-file ./server.crt -https-key-file ./server.key
50
54
```
51
55
52
56
### Unit testing helper library
@@ -114,7 +118,8 @@ variables (or a combination of the two):
114
118
115
119
## Installation
116
120
117
- To add go-httpbin to an existing golang project:
121
+ To add go-httpbin as a dependency to an existing golang project (e.g. for use
122
+ in unit tests):
118
123
119
124
```
120
125
go get -u github.com/mccutchen/go-httpbin/v2
@@ -123,7 +128,7 @@ go get -u github.com/mccutchen/go-httpbin/v2
123
128
To install the ` go-httpbin ` binary:
124
129
125
130
```
126
- go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin
131
+ go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@latest
127
132
```
128
133
129
134
@@ -223,8 +228,11 @@ Compared to [ahmetb/go-httpbin][ahmet]:
223
228
224
229
225
230
[ ahmet ] : https://github.com/ahmetb/go-httpbin
231
+ [ alibaba-headers ] : https://www.alibabacloud.com/help/en/fc/user-guide/specification-details#section-3f8-5y1-i77
232
+ [ DEVELOPMENT.md ] : ./DEVELOPMENT.md
226
233
[ docker-hub ] : https://hub.docker.com/r/mccutchen/go-httpbin/
227
234
[ examples/custom-instrumentation ] : ./examples/custom-instrumentation/
235
+ [ ghcr ] : https://github.com/mccutchen/go-httpbin/pkgs/container/go-httpbin
228
236
[ httpbin-org ] : https://httpbin.org/
229
237
[ httpbin-repo ] : https://github.com/kennethreitz/httpbin
230
238
[ httpbingo.org ] : https://httpbingo.org/
@@ -233,5 +241,3 @@ Compared to [ahmetb/go-httpbin][ahmet]:
233
241
[ Observer ] : https://pkg.go.dev/github.com/mccutchen/go-httpbin/v2/httpbin#Observer
234
242
[ Production considerations ] : #production-considerations
235
243
[ zerolog ] : https://github.com/rs/zerolog
236
- [ DEVELOPMENT.md ] : ./DEVELOPMENT.md
237
- [ alibaba-headers ] : https://www.alibabacloud.com/help/en/fc/user-guide/specification-details#section-3f8-5y1-i77
0 commit comments