File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,14 @@ set -o errexit
6
6
set -o pipefail
7
7
set -o nounset
8
8
9
- docker build -t regexplanet-go .
9
+ docker build \
10
+ --build-arg COMMIT=$( git rev-parse --short HEAD) -local \
11
+ --build-arg LASTMOD=$( date -u +%Y-%m-%dT%H:%M:%SZ) \
12
+ --tag regexplanet-go \
13
+ .
14
+
10
15
docker run \
11
16
--publish 4000:4000 \
12
17
--expose 4000 \
13
18
--env PORT=' 4000' \
14
- --env COMMIT=$( git rev-parse --short HEAD) \
15
- --env LASTMOD=$( date -u +%Y-%m-%dT%H:%M:%SZ) \
16
19
regexplanet-go
Original file line number Diff line number Diff line change @@ -57,15 +57,18 @@ type Status struct {
57
57
TempDir string
58
58
}
59
59
60
+ var COMMIT string
61
+ var LASTMOD string
62
+
60
63
func status_handler (w http.ResponseWriter , r * http.Request ) {
61
64
var err error
62
65
status := Status {}
63
66
64
67
status .Success = true
65
68
status .Message = "OK"
66
69
status .Timestamp = time .Now ().UTC ().Format (time .RFC3339 )
67
- status .Commit = os . Getenv ( " COMMIT" )
68
- status .Lastmod = os . Getenv ( " LASTMOD" )
70
+ status .Commit = COMMIT
71
+ status .Lastmod = LASTMOD
69
72
status .Tech = runtime .Version ()
70
73
71
74
status .Getwd , err = os .Getwd ()
@@ -79,7 +82,7 @@ func status_handler(w http.ResponseWriter, r *http.Request) {
79
82
}
80
83
81
84
status .TempDir = os .TempDir ()
82
- status .Version = runtime .Version ()
85
+ status .Version = runtime .Version ()[ 2 :] // remove "go" prefix
83
86
status .Seconds = time .Now ().Unix ()
84
87
85
88
write_with_callback (w , r .FormValue ("callback" ), status )
You can’t perform that action at this time.
0 commit comments