Skip to content

Commit 22bffa4

Browse files
committed
add dockerfile
Signed-off-by: cwen0 <[email protected]>
1 parent 1df917a commit 22bffa4

File tree

5 files changed

+987
-5
lines changed

5 files changed

+987
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.so
66
*.dylib
77
.idea
8+
bin
89

910
# Test binary, built with `go test -c`
1011
*.test

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM alpine:3.10
2+
3+
RUN apk add tzdata --no-cache
4+
5+
ADD ./bin/web-show /usr/local/bin/web-show
6+
ADD ./web/build /build
7+
8+
CMD ["/usr/local/bin/web-show"]

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SET DOCKER_REGISTRY to change the docker registry
2+
DOCKER_REGISTRY_PREFIX := $(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/,)
3+
4+
# Enable GO111MODULE=on explicitly, disable it with GO111MODULE=off when necessary.
5+
export GO111MODULE := on
6+
GOOS := $(if $(GOOS),$(GOOS),"linux")
7+
GOARCH := $(if $(GOARCH),$(GOARCH),"amd64")
8+
GOENV := GO15VENDOREXPERIMENT="1" CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH)
9+
CGOENV := GO15VENDOREXPERIMENT="1" CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH)
10+
GO := $(GOENV) go
11+
12+
default: build image image-push
13+
14+
build:
15+
$(GO) build -o bin/web-show *.go
16+
cd web; npm install; npm run build
17+
18+
image:
19+
docker build -t ${DOCKER_REGISTRY_PREFIX}pingcap/web-show .
20+
21+
image-push:
22+
docker push "${DOCKER_REGISTRY_PREFIX}pingcap/web-show:latest"
23+
24+
25+
.PYTHON: build

0 commit comments

Comments
 (0)