Skip to content

Commit

Permalink
Shrink image size (650MB => 85MB) + add Go dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-bouvy committed Jan 18, 2020
1 parent b203758 commit b0b9b80
Show file tree
Hide file tree
Showing 4 changed files with 225 additions and 4 deletions.
14 changes: 11 additions & 3 deletions Dockerfile
Expand Up @@ -7,16 +7,24 @@ COPY assets /tmp/assets

RUN npm install && npm run build-prod

FROM golang:1.13
FROM golang:1.13 as go-builder

WORKDIR /go/src/app

COPY main.go ./
COPY main.go go.mod go.sum ./
COPY static ./static

COPY --from=node /tmp/static/bundle.js ./static/bundle.js

RUN go get -d -v ./...
RUN go install -v ./...

CMD ["app"]
FROM debian:buster-slim

COPY --from=go-builder /go/bin/GoPubSub /usr/local/bin/gopubsub
COPY --from=go-builder /go/src/app /go/src/app

# Legacy config directory
WORKDIR /go/src/app/

CMD ["gopubsub"]
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -21,7 +21,7 @@ Following environment variables may be set:

| Variable | Usage | Default value |
|---|---|---|
| `GOPUBSUB_CONFIG` | Config file path | `config.yaml` |
| `GOPUBSUB_CONFIG` | Config file path | `/go/src/app/config.yaml` |
| `GOPUBSUB_PORT` | Listening HTTP port | `8080` |
| `GOPUBSUB_MAX_MESSAGES` | Only keep last _n_ messages per topic | `10` |
| `GOOGLE_APPLICATION_CREDENTIALS` | Path to JSON credentials file | _none_ |
Expand Down
11 changes: 11 additions & 0 deletions go.mod
@@ -0,0 +1,11 @@
module github.com/ClickAndMortar/GoPubSub

require (
cloud.google.com/go/pubsub v1.0.1
github.com/alexandrevicenzi/go-sse v0.0.0-20200117161408-7b23d5ff7420
github.com/gobuffalo/packr v1.30.1
google.golang.org/api v0.13.0 // indirect
gopkg.in/yaml.v2 v2.2.7
)

go 1.13

0 comments on commit b0b9b80

Please sign in to comment.