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 a7df90b
Show file tree
Hide file tree
Showing 3 changed files with 46 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
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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

ARG USER=default
ENV HOME /home/$USER

# install sudo as root
RUN apk add --update sudo

# add new user
RUN adduser -D $USER
USER $USER
WORKDIR $HOME

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 a7df90b

Please sign in to comment.