Skip to content

Commit

Permalink
cmd/ofactest: add Docker image and build step
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Feb 21, 2019
1 parent b8dffd8 commit 674256e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
16 changes: 16 additions & 0 deletions cmd/ofactest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.11-alpine as builder
RUN apk add -U make git
RUN adduser -D -g '' --shell /bin/false moov

# Build ofactest binary (using client generated with)
WORKDIR /go/src/github.com/moov-io/ofac
COPY . .
RUN make build-ofactest
USER moov

FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /go/src/github.com/moov-io/ofac/bin/ofactest /bin/ofactest
COPY --from=builder /etc/passwd /etc/passwd
USER moov
ENTRYPOINT ["/bin/ofactest"]
10 changes: 8 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ VERSION := $(shell grep -Eo '(v[0-9]+[\.][0-9]+[\.][0-9]+(-[a-zA-Z0-9]*)?)' vers

.PHONY: build build-server build-examples docker release check

build: check build-server build-examples
build: check build-server build-ofactest build-examples

build-server:
CGO_ENABLED=1 go build -o ./bin/server github.com/moov-io/ofac/cmd/server

build-examples: build-search-example build-webhook-example
build-ofactest:
CGO_ENABLED=0 go build -o ./bin/ofactest github.com/moov-io/ofac/cmd/ofactest

build-examples: build-webhook-example

build-webhook-example:
CGO_ENABLED=0 go build -o ./bin/webhook-example github.com/moov-io/ofac/examples/webhook
Expand Down Expand Up @@ -35,6 +38,9 @@ docker:
# Main OFAC server Docker image
docker build --pull -t moov/ofac:$(VERSION) -f Dockerfile .
docker tag moov/ofac:$(VERSION) moov/ofac:latest
# ofactest image
docker build --pull -t moov/ofactest:$(VERSION) -f ./cmd/ofactest/Dockerfile .
docker tag moov/ofactest:$(VERSION) moov/ofactest:latest
# webhook example
docker build --pull -t moov/ofac-webhook-example:$(VERSION) -f ./examples/webhook/Dockerfile .
docker tag moov/ofac-webhook-example:$(VERSION) moov/ofac-webhook-example:latest
Expand Down

0 comments on commit 674256e

Please sign in to comment.