Skip to content

Commit

Permalink
Make dashboard image build fast
Browse files Browse the repository at this point in the history
Signed-off-by: Xuhui zhang <[email protected]>
  • Loading branch information
zxh326 committed Mar 15, 2024
1 parent 8b68de2 commit ac6e0bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ dashboard-dist:
.PHONY: dashboard
dashboard:
mkdir -p bin
go build -tags=jsoniter -ldflags ${LDFLAGS} -o bin/juicefs-csi-dashboard ./cmd/dashboard/
CGO_ENABLED=0 go build -tags=jsoniter -ldflags ${LDFLAGS} -o bin/juicefs-csi-dashboard ./cmd/dashboard/

.PHONY: dashboard-dev
dashboard-dev: dashboard
./bin/juicefs-csi-dashboard -v=6 --dev --static-dir=./dashboard-ui/dist

.PHONY: dashboard-image
dashboard-image:
dashboard-image: dashboard
docker build --build-arg HTTP_PROXY=$(HTTP_PROXY) --build-arg HTTPS_PROXY=$(HTTPS_PROXY) --build-arg GOPROXY=$(GOPROXY) \
-t $(REGISTRY)/juicedata/csi-dashboard:$(VERSION) -f docker/dashboard.Dockerfile .

Expand All @@ -88,10 +88,10 @@ uninstall: yaml

# build dev image
.PHONY: image-dev
image-dev: juicefs-csi-driver
image-dev: juicefs-csi-driver dashboard
docker build --build-arg TARGETARCH=$(TARGETARCH) -t $(IMAGE):$(DEV_TAG) -f docker/dev.Dockerfile bin
docker build --build-context project=. --build-context ui=dashboard-ui/ -f docker/dashboard.Dockerfile \
-t $(REGISTRY)/$(DASHBOARD_IMAGE):$(DEV_TAG) .
-t $(REGISTRY)/$(DASHBOARD_IMAGE):$(DEV_TAG) bin

# push dev image
.PHONY: push-dev
Expand Down
15 changes: 1 addition & 14 deletions docker/dashboard.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.20-alpine as builder
ARG GOPROXY
ARG HTTPS_PROXY
ARG HTTP_PROXY
WORKDIR /workspace
COPY --from=project **/*.go ./
COPY --from=project cmd ./cmd
COPY --from=project pkg ./pkg
COPY --from=project go.mod .
COPY --from=project go.sum .
COPY --from=project Makefile .
RUN apk add --no-cache make && make dashboard

FROM alpine:3.18
COPY --from=ui dist /dist
COPY --from=builder /workspace/bin/juicefs-csi-dashboard /usr/local/bin/juicefs-csi-dashboard
COPY juicefs-csi-dashboard /usr/local/bin/juicefs-csi-dashboard
ENTRYPOINT ["juicefs-csi-dashboard"]

0 comments on commit ac6e0bb

Please sign in to comment.