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
66set -o pipefail
77set -o nounset
88
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+
1015docker run \
1116 --publish 4000:4000 \
1217 --expose 4000 \
1318 --env PORT=' 4000' \
14- --env COMMIT=$( git rev-parse --short HEAD) \
15- --env LASTMOD=$( date -u +%Y-%m-%dT%H:%M:%SZ) \
1619 regexplanet-go
Original file line number Diff line number Diff line change @@ -57,15 +57,18 @@ type Status struct {
5757 TempDir string
5858}
5959
60+ var COMMIT string
61+ var LASTMOD string
62+
6063func status_handler (w http.ResponseWriter , r * http.Request ) {
6164 var err error
6265 status := Status {}
6366
6467 status .Success = true
6568 status .Message = "OK"
6669 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
6972 status .Tech = runtime .Version ()
7073
7174 status .Getwd , err = os .Getwd ()
@@ -79,7 +82,7 @@ func status_handler(w http.ResponseWriter, r *http.Request) {
7982 }
8083
8184 status .TempDir = os .TempDir ()
82- status .Version = runtime .Version ()
85+ status .Version = runtime .Version ()[ 2 :] // remove "go" prefix
8386 status .Seconds = time .Now ().Unix ()
8487
8588 write_with_callback (w , r .FormValue ("callback" ), status )
You can’t perform that action at this time.
0 commit comments