Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
539d15c0a5 |
No files matched your search
+1
-5
@@ -1,11 +1,7 @@
|
|||||||
# Docker does not read .gitignore, and a pattern here matches from the root of
|
# Docker does not read .gitignore, and a pattern here matches from the root of
|
||||||
# the build context only: a pattern meant for every directory needs `**/`.
|
# the build context only: a pattern meant for every directory needs `**/`.
|
||||||
|
|
||||||
# .git is sent without its config. Without a VERSION build argument the
|
.git
|
||||||
# stage that compiles runs `git describe --tags --always` on .git, which
|
|
||||||
# does not need .git/config; that file can hold a credential, such as a
|
|
||||||
# password in a remote URL or the token the CI checkout step stores there.
|
|
||||||
.git/config
|
|
||||||
|
|
||||||
# Local build and debug output: `make build`, `make run`, `make asupdate`, test
|
# Local build and debug output: `make build`, `make run`, `make asupdate`, test
|
||||||
# binaries, coverage profiles and source archives.
|
# binaries, coverage profiles and source archives.
|
||||||
|
|||||||
+2
-17
@@ -40,23 +40,8 @@ RUN go mod download && go mod vendor
|
|||||||
# installed above. The suite is offline (the live-feed test is opt-in).
|
# installed above. The suite is offline (the live-feed test is opt-in).
|
||||||
RUN make test
|
RUN make test
|
||||||
|
|
||||||
# Build the binary with CGO enabled (required for sqlite3). The version the
|
# Build the binary with CGO enabled (required for sqlite3)
|
||||||
# page footer shows is the VERSION build argument when one is given, otherwise
|
RUN CGO_ENABLED=1 GOOS=linux go build -o /routewatch ./cmd/routewatch
|
||||||
# `git describe --tags --always` of the .git in the build context (git comes
|
|
||||||
# with this image): the tag on a tagged commit, tag-N-gHASH after one, the
|
|
||||||
# short commit when no tag is reachable. A context that carries .git and still
|
|
||||||
# yields no version fails the build. The footer links to the full commit.
|
|
||||||
ARG VERSION
|
|
||||||
RUN version="${VERSION:-$(git describe --tags --always || echo unknown)}"; \
|
|
||||||
if [ -e .git ] && { [ -z "$version" ] || [ "$version" = dev ] || \
|
|
||||||
[ "$version" = unknown ]; }; then \
|
|
||||||
echo "no version could be derived although the build context carries .git" >&2; \
|
|
||||||
exit 1; \
|
|
||||||
fi; \
|
|
||||||
CGO_ENABLED=1 GOOS=linux go build -o /routewatch -ldflags "\
|
|
||||||
-X git.eeqj.de/sneak/routewatch/internal/version.GitRevision=$(git rev-parse --verify HEAD || echo unknown) \
|
|
||||||
-X git.eeqj.de/sneak/routewatch/internal/version.GitRevisionShort=$version" \
|
|
||||||
./cmd/routewatch
|
|
||||||
|
|
||||||
# Create source archive with vendored dependencies
|
# Create source archive with vendored dependencies
|
||||||
RUN tar --zstd -cf /routewatch-source.tar.zst \
|
RUN tar --zstd -cf /routewatch-source.tar.zst \
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ export DEBUG = routewatch
|
|||||||
|
|
||||||
# Git revision for version embedding
|
# Git revision for version embedding
|
||||||
GIT_REVISION := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown")
|
GIT_REVISION := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown")
|
||||||
GIT_REVISION_SHORT := $(shell git describe --tags --always 2>/dev/null || echo "unknown")
|
GIT_REVISION_SHORT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||||
VERSION_PKG := git.eeqj.de/sneak/routewatch/internal/version
|
VERSION_PKG := git.eeqj.de/sneak/routewatch/internal/version
|
||||||
LDFLAGS := -X $(VERSION_PKG).GitRevision=$(GIT_REVISION) -X $(VERSION_PKG).GitRevisionShort=$(GIT_REVISION_SHORT)
|
LDFLAGS := -X $(VERSION_PKG).GitRevision=$(GIT_REVISION) -X $(VERSION_PKG).GitRevisionShort=$(GIT_REVISION_SHORT)
|
||||||
|
|
||||||
|
|||||||
@@ -27,14 +27,9 @@ real 5 GiB limit (https://git.eeqj.de/sneak/routewatch/issues/3).
|
|||||||
|
|
||||||
# Completed Steps
|
# Completed Steps
|
||||||
|
|
||||||
- 2026-10-03: `/api/v1/stats` serves the prefix distribution from memory,
|
- 2026-09-29: `/api/v1/stats` serves the prefix distribution from memory,
|
||||||
seeded at startup and adjusted on every live-route write, so a request no
|
seeded at startup and adjusted on every live-route write, so a request no
|
||||||
longer reads every live route (closes #30)
|
longer reads every live route (closes #30)
|
||||||
- 2026-10-02: a plain `docker build .` stamps the commit's tag or short
|
|
||||||
commit (`git describe --tags --always`) into the page footer instead of
|
|
||||||
`unknown`: `.dockerignore` sends `.git` without `.git/config`, a `VERSION`
|
|
||||||
build argument takes precedence, and `make build` stamps the same value
|
|
||||||
(closes #46)
|
|
||||||
- 2026-09-29: the entrypoint creates the data directory if it is missing and
|
- 2026-09-29: the entrypoint creates the data directory if it is missing and
|
||||||
stops the start if a step fails; README "Running under upaas" no longer
|
stops the start if a step fails; README "Running under upaas" no longer
|
||||||
asks for the host directory to be created first (closes #42)
|
asks for the host directory to be created first (closes #42)
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ package version
|
|||||||
var (
|
var (
|
||||||
// GitRevision is the git commit hash
|
// GitRevision is the git commit hash
|
||||||
GitRevision = "unknown"
|
GitRevision = "unknown"
|
||||||
// GitRevisionShort is the version the page footer shows: the tag or
|
// GitRevisionShort is the short git commit hash (7 chars)
|
||||||
// short commit hash from `git describe --tags --always`
|
|
||||||
GitRevisionShort = "unknown"
|
GitRevisionShort = "unknown"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+2
-11
@@ -1,8 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# script/docker: build the Docker image tagged with the project name.
|
# script/docker: build the Docker image tagged with the project name.
|
||||||
# Identical in all repos; the tag comes from script/projectname.
|
# Identical in all repos; the tag comes from script/projectname.
|
||||||
# --no-cache because the gate phases the final stage depends on are RUN
|
# Generic: needs no adaptation.
|
||||||
# steps, and a cached one is a check that did not run.
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
||||||
@@ -10,15 +9,7 @@ ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
# Own line: a failing command substitution inside an argument does
|
docker build -t "$("$SCRIPT_DIR/projectname")" .
|
||||||
# not trip `set -e`, so the inline form degrades silently to an
|
|
||||||
# empty constant. The VERSION build argument takes precedence over
|
|
||||||
# the version a build stage derives from the .git in the context.
|
|
||||||
version="$(git describe --tags --always --dirty 2>/dev/null || true)"
|
|
||||||
[ -n "$version" ] || version="unknown"
|
|
||||||
docker build --no-cache \
|
|
||||||
--build-arg VERSION="$version" \
|
|
||||||
-t "$("$SCRIPT_DIR/projectname")" .
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
Reference in new issue
Block a user