Skip to content

Commit

Permalink
Add a build and run Dockerfile (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
rorpage authored and jmattheis committed Feb 21, 2019
1 parent c6a1c3f commit 5e7afe5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# build
FROM golang:1.11.5-stretch AS build-env

WORKDIR /src

ADD . .

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o app .

# run
FROM alpine

RUN apk add --no-cache \
ca-certificates

RUN addgroup -S app \
&& adduser -S -g app app

WORKDIR /home/app

COPY --from=build-env /src/app .

RUN chown -R app:app ./

USER app
ENV USER=app

ENTRYPOINT ["./app"]
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,26 @@ Gotify-CLI will search the following paths for a config file:
"token": "A4ZudDRdLT40L5X",
"url": "https://gotify.example.com"
}
```

### Dockerfile
The Dockerfile contains the steps necessary to build a new version of the CLI and then run it in
a minimal Alpine container.

**Build:**

```bash
docker build -t gotify/gotify-cli .
```

**Run (this assumes your `cli.json` file is in the current working directory):**

```bash
docker run -it -v "$PWD/cli.json:/home/app/cli.json" gotify/gotify-cli:latest push -p 5 "Test from Gotify CLI"
```

[gotify/server]: https://github.com/gotify/server
[travis-badge]: https://travis-ci.org/gotify/cli.svg?branch=master
[travis]: https://travis-ci.org/gotify/cli
[badge-release]: https://img.shields.io/github/release/gotify/cli.svg
[release]: https://github.com/gotify/cli/releases/latest
[release]: https://github.com/gotify/cli/releases/latest

0 comments on commit 5e7afe5

Please sign in to comment.