Skip to content

Commit

Permalink
Add Dockerfile for example CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramon Quitales committed Mar 21, 2020
1 parent 3680068 commit 7ab20de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2020 Ramon Quitales
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT

FROM golang:1.14.1-alpine AS builder
WORKDIR /go/memdb/
COPY . /go/memdb/
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o go-memdb .

FROM alpine:latest
WORKDIR /memdb/
COPY --from=builder /go/memdb/go-memdb /memdb/go-memdb
CMD ["./go-memdb"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ db := memdb.NewDB()
Please refer to the [GoDoc](https://pkg.go.dev/github.com/rquitales/go-memdb) page full documentation. A example CLI implementation of `memdb` can also be seen in the [main.go](main.go) file.

### Running The Example CLI
#### From Source
1. Download the appropriate binary from your target OS from the [releases page](https://github.com/rquitales/go-memdb/releases), or compile from source with `go build -v .` after cloning this repository.
2. Start the executable, eg: `./go-memdb`
3. Type your commands (into STDIN)
Expand All @@ -65,6 +66,15 @@ Please refer to the [GoDoc](https://pkg.go.dev/github.com/rquitales/go-memdb) pa

The query/functions are case insensitive, but the key/values are case sensitive!

#### With Docker
1. Build the docker image from the given Dockerfile in this project:
```
docker build -t go-memdb .
```
2. Run the built image in a container interactively:
```
docker run -it --rm go-memdb
```
Expand Down

0 comments on commit 7ab20de

Please sign in to comment.