Skip to content

Commit

Permalink
Bundle certifier into docker image
Browse files Browse the repository at this point in the history
**What**
- Create a docker image that pre-compiles the certifier tests so that
  the tests are more portable

Signed-off-by: Lucas Roesler <[email protected]>
  • Loading branch information
LucasRoesler committed May 24, 2020
1 parent 30c5ee5 commit 8471df6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ jobs:
- arkade install openfaas --basic-auth=false
- kubectl rollout status -n openfaas deploy/gateway -w
script: make test-kubernetes
- name: build
script: make build
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG goversion=1.14
ARG alpineversion=3.11
FROM golang:$goversion as builder


WORKDIR /app

COPY go.mod .
COPY go.sum .

RUN go mod download

ENV GO111MODULE=on
ENV CGO_ENABLED=0
ARG GOOS=linux

WORKDIR /app
COPY tests ./tests
COPY vendor ./vendor

RUN go test -c -o certifier ./tests

FROM alpine:$alpineversion

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

COPY --from=builder /app/certifier /bin/certifier

ENTRYPOINT [ "/bin/certifier" ]
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ test-swarm: clean-swarm

test-kubernetes: clean-kubernetes
time go test -count=1 ./tests -v -gateway=${OPENFAAS_URL} ${.FEATURE_FLAGS} ${.TEST_FLAGS}


build:
docker build --cache-from openfaas/certifier:latest -t openfaas/certifier:latest .

0 comments on commit 8471df6

Please sign in to comment.