Changed Stats default behavior
This commit is contained in:
parent
6725550ab9
commit
ec4151cec5
3 changed files with 15 additions and 11 deletions
|
@ -45,6 +45,8 @@ docker-build-prod-latest:
|
||||||
- |
|
- |
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 \
|
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 \
|
||||||
|
--build-arg CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH \
|
||||||
|
--build-arg CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA \
|
||||||
--push \
|
--push \
|
||||||
--tag $CI_REGISTRY_IMAGE:latest \
|
--tag $CI_REGISTRY_IMAGE:latest \
|
||||||
.
|
.
|
||||||
|
|
15
Dockerfile
15
Dockerfile
|
@ -1,6 +1,14 @@
|
||||||
FROM golang:alpine as builder
|
FROM golang:alpine as builder
|
||||||
|
|
||||||
RUN apk add --no-cache git make build-base
|
RUN apk add --no-cache git make build-base
|
||||||
|
|
||||||
|
ARG CI_COMMIT_BRANCH
|
||||||
|
ARG CI_COMMIT_SHORT_SHA
|
||||||
|
|
||||||
|
ENV CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH
|
||||||
|
ENV CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
|
||||||
|
|
||||||
|
ENV I_PACKAGE="git.ucode.space/Phil/goshorly/utils"
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
|
|
||||||
WORKDIR /go/src/git.ucode.space/goshorly
|
WORKDIR /go/src/git.ucode.space/goshorly
|
||||||
|
@ -8,12 +16,7 @@ COPY . .
|
||||||
|
|
||||||
RUN go get -d -v ./...
|
RUN go get -d -v ./...
|
||||||
|
|
||||||
# RUN export I_PACKAGE="git.ucode.space/Phil/goshorly/utils" && \
|
RUN go build -a -installsuffix -ldflags="-w -s -X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app .
|
||||||
# export I_GitCommitShort=$(git rev-parse --short HEAD) && \
|
|
||||||
# export I_GitBranch=$(git rev-parse --abbrev-ref HEAD) && \
|
|
||||||
# go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app .
|
|
||||||
|
|
||||||
RUN go build -a -installsuffix -ldflags="-w -s" -o app .
|
|
||||||
|
|
||||||
FROM scratch as production
|
FROM scratch as production
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
package db
|
package db
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetTotalLinks() int {
|
func GetTotalLinks() int {
|
||||||
val1, err1 := Client.Get("total-links").Result()
|
val1, err1 := Client.Get("total-links").Result()
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
log.Fatal(err1)
|
return 0
|
||||||
}
|
}
|
||||||
val2, err2 := strconv.Atoi(val1)
|
val2, err2 := strconv.Atoi(val1)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
log.Fatal(err1)
|
return 0
|
||||||
}
|
}
|
||||||
return val2
|
return val2
|
||||||
}
|
}
|
||||||
|
@ -20,11 +19,11 @@ func GetTotalLinks() int {
|
||||||
func GetTotalViews() int {
|
func GetTotalViews() int {
|
||||||
val1, err1 := Client.Get("total-views").Result()
|
val1, err1 := Client.Get("total-views").Result()
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
log.Fatal(err1)
|
return 0
|
||||||
}
|
}
|
||||||
val2, err2 := strconv.Atoi(val1)
|
val2, err2 := strconv.Atoi(val1)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
log.Fatal(err1)
|
return 0
|
||||||
}
|
}
|
||||||
return val2
|
return val2
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue