Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Add evicter to docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Jan 31, 2020
1 parent 13fca19 commit e7c0cac
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
k-rail
vendor
/k-rail
/evicter
vendor
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ ARG GO_VERSION=1.13
FROM golang:${GO_VERSION}-buster AS builder
WORKDIR /build
COPY ./ /build/
RUN make test
RUN make clean test
RUN make build

# Production image build stage
FROM scratch
EXPOSE 8443/tcp
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /build/k-rail /k-rail
COPY --from=builder /build/evicter /evicter
USER 65534
ENTRYPOINT ["/k-rail", "-config", "/config/config.yml"]
24 changes: 19 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,27 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: all build test image clean

ensure:
dep ensure
LDFLAGS = -extldflags=-static -s -w
BUILD_FLAGS = -mod=readonly -ldflags '$(LDFLAGS)' -trimpath
BUILD_VERSION ?= manual
IMAGE_NAME = "cruise/k-rail:${BUILD_VERSION}"

all: dist

dist: image

clean:
rm -f evicter k-rail
go mod verify

build:
GO111MODULE=on CGO_ENABLED=0 go build -o k-rail cmd/main.go
GO111MODULE=on CGO_ENABLED=0 go build ${BUILD_FLAGS} -o k-rail cmd/k-rail/main.go
GO111MODULE=on CGO_ENABLED=0 go build ${BUILD_FLAGS} -o evicter cmd/evicter/*.go

test:
GO111MODULE=on CGO_ENABLED=1 go test -race -cover $(shell go list ./... | grep -v /vendor/)

GO111MODULE=on CGO_ENABLED=1 go test -mod=readonly -race ./...

image: build
docker build --pull -t $(IMAGE_NAME) .
File renamed without changes.

0 comments on commit e7c0cac

Please sign in to comment.