Skip to content

Commit

Permalink
Merge pull request #25 from reactiveops/rs/tests
Browse files Browse the repository at this point in the history
Improved Tests, Go Modules, More Secure Deployment Configuration
  • Loading branch information
robscott authored Oct 17, 2018
2 parents e22fd74 + 1762eca commit b0096cd
Show file tree
Hide file tree
Showing 18 changed files with 822 additions and 1,354 deletions.
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,27 @@ references:
docker build -f Dockerfile -t quay.io/reactiveops/rbac-manager:$DOCKER_BASE_TAG .
docker push quay.io/reactiveops/rbac-manager:$DOCKER_BASE_TAG
kubebuilder_setup: &kubebuilder_setup
run:
name: Setup Kubebuilder
command: |
curl -L -O https://github.com/kubernetes-sigs/kubebuilder/releases/download/v0.1.12/kubebuilder_0.1.12_linux_amd64.tar.gz
tar -zxvf kubebuilder_0.1.12_linux_amd64.tar.gz
sudo mv kubebuilder_0.1.12_linux_amd64 /usr/local/kubebuilder
jobs:
test:
docker:
- image: circleci/golang:1.11
environment:
GO111MODULE: "on"

steps:
- checkout
- *kubebuilder_setup
- run: go mod download && go mod verify
- run: go test ./pkg/controller/rbacdefinition/...

build:
docker:
- image: circleci/buildpack-deps:jessie
Expand All @@ -33,6 +53,7 @@ workflows:
version: 2
build:
jobs:
- test
- build:
context: org-global
filters:
Expand Down
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
vendor
examples
deploy
.vscode
.vscode
.dockerignore
Dockerfile
20 changes: 9 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
FROM golang:1.10.4 AS build-env
FROM golang:1.11 AS build-env
WORKDIR /go/src/github.com/reactiveops/rbac-manager/

RUN go get -u github.com/golang/dep/...

COPY Gopkg.toml Gopkg.lock ./
RUN dep ensure -vendor-only
ENV GO111MODULE "on"

COPY . .

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o controller-manager ./cmd/controller-manager/main.go
RUN go mod download && go mod verify
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o rbac-manager ./cmd/controller-manager/main.go

FROM alpine:3.8
WORKDIR /usr/local/bin
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=build-env /go/src/github.com/reactiveops/rbac-manager/controller-manager .

ENTRYPOINT ["./controller-manager"]
USER nobody
COPY --from=build-env /go/src/github.com/reactiveops/rbac-manager/rbac-manager .

ENTRYPOINT ["rbac-manager"]
CMD ["--install-crds=false"]
Loading

0 comments on commit b0096cd

Please sign in to comment.