Skip to content

Commit af2b5d9

Browse files
committed
feat: add chart function
1 parent c7bd2fb commit af2b5d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1808
-537
lines changed

.dockerignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
node_modules
2+
npm-debug.log
3+
Dockerfile*
4+
docker-compose*
5+
.dockerignore
6+
.gitignore
7+
.env
8+
*/bin
9+
*/obj
10+
README.md
11+
LICENSE
12+
.vscode
13+
.DS_Store
14+
.idea
15+
16+
17+
# .git
18+
data/
19+
nginx/
20+
leetcode-badge

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
main
1515
leetcode-badge
1616
nginx/
17+
data/
1718
docker-compose.yml
1819
static/*.go

Dockerfile

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
1-
ARG GO_VERSION=1.12.9
1+
FROM haozibi/upx AS build-upx
22

3-
FROM golang:${GO_VERSION}-alpine3.9 AS build-env
3+
FROM golang:1.13.3-alpine3.10 AS build-env
44

5-
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
5+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
66

77
RUN apk --no-cache add build-base git
88

9-
WORKDIR ${GOPATH}/src/github.com/haozibi/leetcode-badge
9+
# build
10+
ARG BIN_NAME=leetcode-badge
11+
WORKDIR /${BIN_NAME}
12+
ADD go.mod .
13+
ADD go.sum .
14+
RUN export GOPROXY=https://goproxy.cn go mod download
15+
ADD . .
16+
RUN make build-linux
1017

11-
COPY . ${GOPATH}/src/github.com/haozibi/leetcode-badge
18+
# upx
19+
WORKDIR /data
20+
COPY --from=build-upx /bin/upx /bin/upx
21+
RUN cp /${BIN_NAME}/${BIN_NAME} /data/main
22+
RUN upx -k --best --ultra-brute /data/main
1223

13-
RUN ls -alh && make build-linux
24+
FROM alpine:3.10
1425

15-
FROM alpine:3.9
16-
17-
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
26+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
1827

1928
RUN apk update && apk add tzdata \
2029
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
2130
&& echo "Asia/Shanghai" > /etc/timezone
2231

2332
RUN apk add --update ca-certificates && rm -rf /var/cache/apk/*
2433

25-
COPY --from=build-env go/src/github.com/haozibi/leetcode-badge/leetcode-badge /main
26-
27-
ENV LCHTTPAddr=":5050"
34+
COPY --from=build-env /data/main /home/main
2835

2936
EXPOSE 5050
3037

31-
ENTRYPOINT ["/main","run"]
38+
ENTRYPOINT ["/home/main","run"]

Gopkg.lock

Lines changed: 0 additions & 234 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 58 deletions
This file was deleted.

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ GOOS?=linux
55
GOARCH?=amd64
66

77
VERSION?=$(shell git describe --tags --always)
8+
COMMIT_HASH?=$(shell git rev-parse --short HEAD 2>/dev/null)
89
NOW?=$(shell date -u '+%Y/%m/%d/%I:%M:%S%Z')
910
PROJECT?=github.com/haozibi/${APP}
1011

1112
LDFLAGS += -X "${PROJECT}/app.BuildTime=${NOW}"
1213
LDFLAGS += -X "${PROJECT}/app.BuildVersion=${VERSION}"
1314
LDFLAGS += -X "${PROJECT}/app.BuildAppName=${APP}"
15+
LDFLAGS += -X "${PROJECT}/app.CommitHash=${COMMIT_HASH}"
1416
BUILD_TAGS = ""
1517
BUILD_FLAGS = "-v"
1618
# PROTO_LOCATION = "internal/protocol_pb"
@@ -27,7 +29,7 @@ build-linux: clean bindata govet
2729
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build ${BUILD_FLAGS} -ldflags '${LDFLAGS}' -tags '${BUILD_TAGS}' -o ${APP}
2830

2931
bindata: clean
30-
@ go get github.com/jteeuwen/go-bindata/...
32+
@ export GOPROXY=https://goproxy.cn && go get github.com/jteeuwen/go-bindata/...
3133
@ go-bindata -nomemcopy -pkg=static \
3234
-debug=false \
3335
-o=static/static.go \

0 commit comments

Comments
 (0)