Skip to content

Commit

Permalink
cleanup dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
SabaPing committed Jan 13, 2023
1 parent 320b30c commit 98f0964
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ If you want to develop docker image locally 🤔.

4. Access TiDB Dashboard at [http://localhost:12333/dashboard](http://localhost:12333/dashboard).

> Dashboard in PD can be accessed at [http://localhost:2379/dashboard](http://localhost:2379/dashboard).
> The old Dashboard **_in PD_** can be accessed at [http://localhost:2379/dashboard](http://localhost:2379/dashboard).

## Contribution flow

Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ IMAGE ?= $(REPOSITORY):$(RELEASE_VERSION)
AMD64 := linux/amd64
ARM64 := linux/arm64
PLATFORMS := $(AMD64),$(ARM64)
DOCKERFILE ?= ./dockerfiles/alpine316.Dockerfile
# If you want to build with no cache (after update go module, npm module, etc.), set "NO_CACHE=--pull --no-cache".
NO_CACHE ?=

Expand Down Expand Up @@ -136,16 +137,16 @@ package: embed_ui_assets server

.PHONY: docker-build-and-push-image # For locally dev, set IMAGE to your dev docker registry.
docker-build-and-push-image: clean
docker buildx build ${NO_CACHE} --push -t $(IMAGE) --platform $(PLATFORMS) .
docker buildx build ${NO_CACHE} --push -t $(IMAGE) --platform $(PLATFORMS) -f $(DOCKERFILE) .

.PHONY: docker-build-image-locally-amd64
docker-build-image-locally-amd64: clean
docker buildx build ${NO_CACHE} --load -t $(IMAGE) --platform $(AMD64) .
docker buildx build ${NO_CACHE} --load -t $(IMAGE) --platform $(AMD64) -f $(DOCKERFILE) .
docker run --rm $(IMAGE) -v

.PHONY: docker-build-image-locally-arm64
docker-build-image-locally-arm64: clean
docker buildx build ${NO_CACHE} --load -t $(IMAGE) --platform $(ARM64) .
docker buildx build ${NO_CACHE} --load -t $(IMAGE) --platform $(ARM64) -f $(DOCKERFILE) .
docker run --rm $(IMAGE) -v

.PHONY: run # please ensure that tiup playground is running in the background.
Expand Down
12 changes: 8 additions & 4 deletions Dockerfile → dockerfiles/alpine316.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@ RUN mkdir -p /go/src/github.com/pingcap/tidb-dashboard/ui
WORKDIR /go/src/github.com/pingcap/tidb-dashboard

# Cache go module dependencies.
COPY go.mod .
COPY go.sum .
COPY ../go.mod .
COPY ../go.sum .
RUN GO111MODULE=on go mod download

# Cache go tools.
COPY ../scripts scripts/
RUN scripts/install_go_tools.sh

# Cache npm dependencies.
WORKDIR /go/src/github.com/pingcap/tidb-dashboard/ui
COPY ui/pnpm-lock.yaml .
COPY ../ui/pnpm-lock.yaml .
RUN pnpm fetch

# Build.
WORKDIR /go/src/github.com/pingcap/tidb-dashboard
COPY . .
COPY .. .
RUN make package PNPM_INSTALL_TAGS=--offline

FROM alpine:3.16
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions centos.Dockerfile → dockerfiles/centos7.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ RUN yum -y install nodejs
RUN npm install -g pnpm

# Install java.
COPY ./scripts/centos.adoptium.repo /etc/yum.repos.d/adoptium.repo
COPY centos.adoptium.repo /etc/yum.repos.d/adoptium.repo
RUN yum -y install temurin-17-jdk

RUN mkdir -p /go/src/github.com/pingcap/tidb-dashboard/ui
WORKDIR /go/src/github.com/pingcap/tidb-dashboard

# Cache go module dependencies.
COPY go.mod .
COPY go.sum .
COPY ../go.mod .
COPY ../go.sum .
RUN GO111MODULE=on go mod download

# Cache go tools.
COPY scripts/ scripts/
COPY ../scripts scripts/
RUN scripts/install_go_tools.sh

# Cache npm dependencies.
WORKDIR /go/src/github.com/pingcap/tidb-dashboard/ui
COPY ui/pnpm-lock.yaml .
COPY ../ui/pnpm-lock.yaml .
RUN pnpm fetch

# Build.
WORKDIR /go/src/github.com/pingcap/tidb-dashboard
COPY . .
COPY .. .
RUN make package PNPM_INSTALL_TAGS=--offline

FROM centos:8
Expand Down
File renamed without changes.

0 comments on commit 98f0964

Please sign in to comment.