Feature 01 task 4: Makefile and multi-stage Dockerfile #5

3 changed files with 12 additions and 4 deletions
Showing only changes of commit 9b66ba0ff5 - Show all commits
+2
View File
@@ -10,6 +10,8 @@ design/
node_modules
web/node_modules
web/dist
# Generated embed output; the Go stage takes the PWA from the web stage.
internal/frontend/dist/
bin/
*.db
*.db-*
+6 -3
View File
@@ -32,8 +32,11 @@ ENV MEALQUEST_HTTP_ADDR=:8080 \
VOLUME /data
EXPOSE 8080
USER 10001:10001
# Probe the port from MEALQUEST_HTTP_ADDR (text after the last colon) so an
# overridden listen address stays healthy.
# Probe the listener from MEALQUEST_HTTP_ADDR: host is everything before the
# last colon (IPv6 keeps its brackets). Wildcard hosts map to loopback, as
# does localhost: Go listens on its IPv4 address but wget would try ::1.
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -q -O /dev/null "http://127.0.0.1:${MEALQUEST_HTTP_ADDR##*:}/health" || exit 1
CMD host="${MEALQUEST_HTTP_ADDR%:*}"; \
case "$host" in ""|0.0.0.0|"[::]"|localhost) host=127.0.0.1 ;; esac; \
wget -q -O /dev/null "http://${host}:${MEALQUEST_HTTP_ADDR##*:}/health" || exit 1
ENTRYPOINT ["/usr/local/bin/mealquest"]
+4 -1
View File
@@ -7,7 +7,10 @@
# make docker Build the container image from ./Dockerfile.
FRONTEND_DIST := internal/frontend/dist
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
# Dirty means a tracked change outside the generated embed output, which
# `make embed` rewrites; plain `--dirty` would flag every rebuild.
GIT_DIRTY := $(shell git status --porcelain --untracked-files=no -- . ':(exclude)$(FRONTEND_DIST)' 2>/dev/null)
VERSION ?= $(shell git describe --tags --always 2>/dev/null || echo dev)$(if $(GIT_DIRTY),-dirty)
IMAGE ?= mealquest:$(VERSION)
LDFLAGS := -s -w -X main.version=$(VERSION)