Skip to content

Commit 7c5ef01

Browse files
joanlopezaperezg
authored andcommitted
Dockerizing. Fixes #7 (#8)
1 parent b33b671 commit 7c5ef01

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM golang:alpine AS build
2+
3+
LABEL MAINTAINER = 'Friends of Go (it@friendsofgo.tech)'
4+
5+
RUN apk add --update git
6+
WORKDIR /go/src/github.com/friendsofgo/killgrave
7+
COPY . .
8+
RUN export GO111MODULE=on && go mod tidy && TAG=$(git describe --tags --abbrev=0) \
9+
&& LDFLAGS=$(echo "-s -w -X main.version="$TAG) \
10+
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /go/bin/killgrave -ldflags "$LDFLAGS" cmd/killgrave/main.go
11+
12+
# Building image with the binary
13+
FROM scratch
14+
COPY --from=build /go/bin/killgrave /go/bin/killgrave
15+
ENTRYPOINT ["/go/bin/killgrave"]

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,18 @@ curl --header "Content-Type: application/json" \
155155
http://localhost:3000/gophers
156156
```
157157
158+
### Docker
159+
160+
The application is also available through [Docker](https://hub.docker.com/r/friendsofgo/killgrave), just run:
161+
162+
```bash
163+
docker run -it --rm -p 3000:3000 friendsofgo/killgrave
164+
```
165+
166+
Remember to use the [-p](https://docs.docker.com/engine/reference/run/) flag to expose the container port where the application is listening (3000 by default).
167+
168+
NOTE: If you want to use `killgrave` through Docker at the same time you use your own dockerised HTTP-based API, be careful with networking issues.
169+
158170
## Features
159171
* Imposters created in json
160172
* Validate json schemas on requests

0 commit comments

Comments
 (0)