Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker and Make builds of utility tool, update travis.yml #15

Merged
merged 3 commits into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ language: go
go:
- 1.9.x
script:
- go test -v ./...
- go build ./...
- go get github.com/golang/dep/cmd/dep
- make
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM golang:alpine
WORKDIR /go/src/github.com/gradienthealth/go-dicom
COPY . .
RUN apk add --no-cache make git
RUN go get github.com/golang/dep/cmd/dep
RUN make
11 changes: 1 addition & 10 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BINARY = dicomutil

.PHONY: build
build:
dep ensure
$(MAKE) test
go build -o build/${BINARY} ./dicomutil

.PHONY: test
test:
go test ./...

.PHONY: run
run:
make build
./${BINARY}

.PHONY: release
release:
dep ensure
$(MAKE) test
GOOS=linux GOARCH=amd64 go build -o build/${BINARY}-linux-amd64 ./dicomutil;
GOOS=darwin GOARCH=amd64 go build -o build/${BINARY}-darwin-amd64 ./dicomutil;
GOOS=windows GOARCH=amd64 go build -o build/${BINARY}-windows-amd64.exe ./dicomutil;
9 changes: 8 additions & 1 deletion dicomutil/dicomutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ var (
)

func main() {
// Update usage docs
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage of %s:\n%s <dicom file> [flags]\n", os.Args[0], os.Args[0])
flag.PrintDefaults()
}

flag.Parse()
if len(flag.Args()) == 0 {
log.Panic("dicomutil <dicomfile>")
flag.Usage()
os.Exit(1)
}
if *verbose {
dicomlog.SetLevel(math.MaxInt32)
Expand Down