Skip to content

Commit 4265695

Browse files
committed
Merge branch 'main' of github.com:friendsofgo/killgrave into acceptance
2 parents 24bb26a + bca67fd commit 4265695

File tree

18 files changed

+475
-312
lines changed

18 files changed

+475
-312
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,36 @@ jobs:
2929
GH_RELEASER: ${{ secrets.GH_RELEASER }}
3030
docker-hub:
3131
needs: release
32-
name: Deploy to docker-hub
32+
name: Deploy to DockerHub
3333
runs-on: ubuntu-latest
3434
steps:
3535
- uses: actions/checkout@v3
3636

37-
- name: Login to docker hub
38-
uses: docker/login-action@v2
37+
- name: Set up QEMU
38+
uses: docker/setup-qemu-action@v3
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Login to DockerHub
44+
uses: docker/login-action@v3
3945
with:
4046
username: ${{ secrets.DOCKER_USERNAME }}
4147
password: ${{ secrets.DOCKER_TOKEN }}
4248

49+
- name: Extract Docker metadata
50+
id: meta
51+
uses: docker/metadata-action@v5
52+
with:
53+
images: ${{ github.repository }}
54+
tags: |
55+
type=ref,event=tag
56+
4357
- name: Build and push to docker registry
4458
if: success()
45-
uses: docker/build-push-action@v4
59+
uses: docker/build-push-action@v5
4660
with:
4761
context: .
62+
platforms: linux/amd64,linux/arm64
4863
push: true
49-
tags: ${GITHUB_REPOSITORY}:latest,${GITHUB_REPOSITORY}:${IMAGE_TAG}
64+
tags: ${{ steps.meta.outputs.tags }}

.goreleaser.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ builds:
2424
- goos: freebsd
2525
goarch: arm64
2626
archives:
27-
-
28-
replacements:
29-
386: i386
30-
amd64: x86_64
27+
-
28+
name_template: >-
29+
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_
30+
{{- if eq .Arch "amd64" }}x86_64
31+
{{- else if eq .Arch "386" }}i386
32+
{{- else }}{{ .Arch }}{{ end }}
33+
{{- if .Arm }}v{{ .Arm }}{{ end }}
3134
format_overrides:
3235
- goos: windows
3336
format: zip

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
FROM golang:1.16-alpine AS build
1+
FROM golang:1.21-alpine AS build
22

33
LABEL MAINTAINER = 'Friends of Go ([email protected])'
44

5+
ARG TARGETOS=linux
6+
ARG TARGETARCH=amd64
7+
58
RUN apk add --update git
69
RUN apk add ca-certificates
710
WORKDIR /go/src/github.com/friendsofgo/killgrave
811
COPY . .
912
RUN go mod tidy && TAG=$(git describe --tags --abbrev=0) \
1013
&& LDFLAGS=$(echo "-s -w -X github.com/friendsofgo/killgrave/internal/app/cmd._version="docker-$TAG) \
11-
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /go/bin/killgrave -ldflags "$LDFLAGS" cmd/killgrave/main.go
14+
&& CGO_ENABLED=0 GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" go build -a -installsuffix cgo -o /go/bin/killgrave -ldflags "$LDFLAGS" cmd/killgrave/main.go
1215

1316
# Building image with the binary
1417
FROM scratch

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ Killgrave is a simulator for HTTP-based APIs, in simple words a **Mock Server**,
99
![Github actions](https://github.com/friendsofgo/killgrave/actions/workflows/main.yaml/badge.svg?branch=main)
1010
[![Version](https://img.shields.io/github/release/friendsofgo/killgrave.svg?style=flat-square)](https://github.com/friendsofgo/killgrave/releases/latest)
1111
[![Go Report Card](https://goreportcard.com/badge/github.com/friendsofgo/killgrave)](https://goreportcard.com/report/github.com/friendsofgo/killgrave)
12-
[![Total alerts](https://img.shields.io/lgtm/alerts/g/friendsofgo/killgrave.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/friendsofgo/killgrave/alerts/)
1312
[![FriendsOfGo](https://img.shields.io/badge/powered%20by-Friends%20of%20Go-73D7E2.svg)](https://friendsofgo.tech)
1413

15-
<p>
16-
<a href="https://www.buymeacoffee.com/friendsofgo" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: 100px !important;" ></a>
17-
</p>
18-
1914
# Table of Content
2015
- [Overview](#overview)
2116
- [Concepts](#concepts)
@@ -91,13 +86,13 @@ $ brew install friendsofgo/tap/killgrave
9186
The application is also available through [Docker](https://hub.docker.com/r/friendsofgo/killgrave).
9287

9388
```bash
94-
docker run -it --rm -p 3000:3000 -v $PWD/:/home -w /home friendsofgo/killgrave -host 0.0.0.0
89+
docker run -it --rm -p 3000:3000 -v $PWD/:/home -w /home friendsofgo/killgrave --host 0.0.0.0
9590
```
9691

9792
`-p 3000:3000` [publishes](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) port 3000 (Killgrave's default port) inside the
9893
container to port 3000 on the host machine.
9994

100-
`-host 0.0.0.0` is necessary to allow Killgrave to listen and respond to requests from outside the container (the default,
95+
`--host 0.0.0.0` is necessary to allow Killgrave to listen and respond to requests from outside the container (the default,
10196
`localhost`, will not capture requests from the host network).
10297

10398
### Compile by yourself

go.mod

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
module github.com/friendsofgo/killgrave
22

3-
go 1.16
3+
go 1.21
44

55
require (
66
github.com/gorilla/handlers v1.5.1
7-
github.com/gorilla/mux v1.8.0
7+
github.com/gorilla/mux v1.8.1
88
github.com/radovskyb/watcher v1.0.7
9-
github.com/spf13/afero v1.6.0
10-
github.com/spf13/cobra v1.0.0
9+
github.com/spf13/cobra v1.8.1
10+
github.com/stretchr/testify v1.9.0
11+
github.com/xeipuuv/gojsonschema v1.2.0
12+
gopkg.in/yaml.v2 v2.4.0
13+
)
14+
15+
require (
16+
github.com/davecgh/go-spew v1.1.1 // indirect
17+
github.com/felixge/httpsnoop v1.0.1 // indirect
18+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
19+
github.com/kr/pretty v0.3.1 // indirect
20+
github.com/pmezard/go-difflib v1.0.0 // indirect
1121
github.com/spf13/pflag v1.0.5 // indirect
12-
github.com/stretchr/testify v1.7.0
1322
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
14-
github.com/xeipuuv/gojsonschema v1.2.0
15-
golang.org/x/tools v0.9.1
23+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
1624
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
17-
gopkg.in/yaml.v2 v2.4.0
25+
gopkg.in/yaml.v3 v3.0.1 // indirect
1826
)

0 commit comments

Comments
 (0)