File tree Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Original file line number Diff line number Diff line change 28
28
name : Setup
29
29
command : |
30
30
go get -v -t -d ./...
31
- go get github.com/GeertJohan/go.rice/rice
31
+ go install github.com/GeertJohan/go.rice/rice@latest
32
32
mkdir output
33
33
go build -ldflags="-s -w" -a -v -o TechChallengeApp .
34
34
ls
@@ -158,7 +158,7 @@ jobs:
158
158
export tagvalue=$(git tag | grep ${version})
159
159
export prerelease=$(echo ${version} | grep 'pre-release')
160
160
if [ -z "${tagvalue}" ]; then
161
- go get github.com/tcnksm/ghr
161
+ go install github.com/tcnksm/ghr@latest
162
162
163
163
if [ -z "${prerelease}" ]; then
164
164
echo "No pre-release in version, creating release"
Original file line number Diff line number Diff line change @@ -2,30 +2,25 @@ FROM golang:alpine AS build
2
2
3
3
RUN apk add --no-cache curl git alpine-sdk
4
4
5
- ARG SWAGGER_UI_VERSION=3.20.9
5
+ ARG SWAGGER_UI_VERSION=4.8.0
6
6
7
- RUN dir=$(mktemp -d) \
8
- && git clone https://github.com/go-swagger/go-swagger "$dir" \
9
- && cd "$dir" \
10
- && go install ./cmd/swagger \
11
- && curl -sfL https://github.com/swagger-api/swagger-ui/archive/v$SWAGGER_UI_VERSION.tar.gz | tar xz -C /tmp/ \
7
+ RUN curl -sfL https://github.com/swagger-api/swagger-ui/archive/v$SWAGGER_UI_VERSION.tar.gz | tar xz -C /tmp/ \
12
8
&& mv /tmp/swagger-ui-$SWAGGER_UI_VERSION /tmp/swagger \
13
9
&& sed -i 's#"https://petstore\. swagger\. io/v2/swagger\. json"#"./swagger.json"#g' /tmp/swagger/dist/index.html
14
10
15
- RUN go get github.com/GeertJohan/go.rice/rice
11
+ RUN go install github.com/go-swagger/go-swagger/cmd/swagger@latest
12
+ RUN go install github.com/GeertJohan/go.rice/rice@latest
16
13
17
14
WORKDIR $GOPATH/src/github.com/servian/TechChallengeApp
18
15
19
- COPY go.mod go.sum $GOPATH/src/github.com/servian/TechChallengeApp/
16
+ COPY . .
20
17
21
18
RUN go mod tidy
22
19
23
- COPY . .
24
-
25
20
RUN CGO_ENABLED="0" go build -ldflags="-s -w" -a -o /TechChallengeApp
26
21
RUN swagger generate spec -o /swagger.json \
27
22
&& cp /swagger.json ui/assets/swagger/ \
28
- && cp -R /tmp/swagger/dist ui/assets/swagger
23
+ && cp -R /tmp/swagger/dist/* ui/assets/swagger
29
24
30
25
RUN cd ui && rice append --exec /TechChallengeApp
31
26
Original file line number Diff line number Diff line change 21
21
package ui
22
22
23
23
import (
24
+ "expvar"
24
25
"fmt"
25
26
"net/http"
26
27
@@ -76,5 +77,6 @@ func uiHandler(cfg Config, router *mux.Router) {
76
77
router .Handle ("/css/{path:.*}" , staticFileServer )
77
78
router .Handle ("/images/{path:.*}" , staticFileServer )
78
79
router .Handle ("/swagger/{path:.*}" , staticFileServer )
80
+ router .Handle ("/metrics" , expvar .Handler ())
79
81
router .Handle ("/" , indexHandler ())
80
82
}
You can’t perform that action at this time.
0 commit comments