diff --git a/Dockerfile b/Dockerfile index cafdaa3..05461e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,9 @@ RUN go mod download # Copy source code COPY . . -# Build statically -RUN CGO_ENABLED=0 GOOS=linux go build -ldflags='-w -s' -o mdhost . +# Build statically with version +ARG APP_VERSION=dev +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s -X main.version=${APP_VERSION}" -o mdhost . # Final scratch image FROM scratch diff --git a/main.go b/main.go index 0576215..6643520 100644 --- a/main.go +++ b/main.go @@ -27,6 +27,7 @@ var ( port = ":8080" markdown = newMarkdownRenderer() dataMu sync.RWMutex + version = "dev" ) // ListFormat configures how files are rendered in the index @@ -536,6 +537,9 @@ const css = `