Add build scripts

This commit is contained in:
niusmallnan 2021-04-13 15:55:35 +08:00
parent 7ee597ebe0
commit e961cd3743
3 changed files with 38 additions and 0 deletions

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
build:
docker build -t niusmallnan/kube-explorer package/
run: build
docker run $(DOCKER_ARGS) --rm -p 8989:9080 -it -v ${HOME}/.kube:/root/.kube steve --https-listen-port 0 --kubeconfig /root/.kube/config
run-host: build
docker run $(DOCKER_ARGS) --net=host --uts=host --rm -it -v ${HOME}/.kube:/root/.kube steve --kubeconfig /root/.kube/config --http-listen-port 8989 --https-listen-port 0

27
package/Dockerfile Normal file
View File

@ -0,0 +1,27 @@
FROM golang:1.15.11 as build
ENV GIT_COMMIT="5049a746da959ae521526d9b672a162c2fef3959"
ENV GIT_BRANCH="dev"
RUN \
mkdir -p /go/src/github.com/rancher/ && \
cd /go/src/github.com/rancher/ && \
git clone --depth=1 --branch ${GIT_BRANCH} https://github.com/niusmallnan/steve.git && \
cd steve && \
git reset --hard ${GIT_COMMIT} && \
go mod vendor && \
CGO_ENABLED=0 go build -ldflags "-X github.com/rancher/steve/pkg/ui.UIOffline=true -extldflags -static -s" -o /steve
FROM alpine:3.13
ENV CATTLE_DASHBOARD_UI_VERSION v2.5.8-rc3
RUN apk -U --no-cache add bash curl ca-certificates && \
mkdir -p /usr/share/rancher/ui-dashboard/dashboard && \
cd /usr/share/rancher/ui-dashboard/dashboard && \
curl -sL https://releases.rancher.com/dashboard/${CATTLE_DASHBOARD_UI_VERSION}.tar.gz | tar xvzf - --strip-components=2 && \
ln -s dashboard/index.html ../index.html
COPY --from=build /steve /usr/bin/steve
COPY entrypoint.sh /usr/bin
# Hack to make golang do files,dns search order
ENV LOCALDOMAIN=""
ENTRYPOINT ["entrypoint.sh"]

3
package/entrypoint.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/usr/bin/steve --ui-path /usr/share/rancher/ui-dashboard "${@}"