Compare commits

...
3 Commits
Author SHA1 Message Date
tanshu 5b691a577b Fix: Using dsh and glm5.3-flash 2026-09-16 04:13:03 +00:00
tanshu aeee758718 Still trying to fix the hatch vcs build issues 2026-09-16 03:32:19 +00:00
tanshu 3dfb0a2b2f Updated dockerfile 2026-09-16 02:06:19 +00:00
2 changed files with 36 additions and 7 deletions
+17 -3
View File
@@ -69,9 +69,14 @@ WORKDIR /app/
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment
ENV PATH="/app/.venv/bin:$PATH"
# Pass version from Makefile to setuptools-scm since .git is not in context
ARG SETUPTOOLS_SCM_PRETEND_VERSION_FOR_BREWMAN
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_BREWMAN=$SETUPTOOLS_SCM_PRETEND_VERSION_FOR_BREWMAN
# Pass the version from the Makefile. The build context has no usable .git
# (a git-URL build is a tag-less shallow clone and git is not installed), so
# hatch-vcs cannot discover the version itself. hatch-vcs calls
# setuptools_scm without a dist name, so only the generic
# SETUPTOOLS_SCM_PRETEND_VERSION is honored - the
# SETUPTOOLS_SCM_PRETEND_VERSION_FOR_<NAME> variant is silently ignored.
ARG SETUPTOOLS_SCM_PRETEND_VERSION
ENV SETUPTOOLS_SCM_PRETEND_VERSION=$SETUPTOOLS_SCM_PRETEND_VERSION
# Install dependencies
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
@@ -81,11 +86,20 @@ RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-install-project
COPY /brewman ./
# hatch-vcs generates _version.py only inside uv's isolated wheel build, so
# the source tree copied here lacks it. Write it ourselves (from the same
# build arg) so importing brewman from /app works identically to the
# installed wheel package in .venv.
RUN printf '__version__ = version = "%s"\n' "$SETUPTOOLS_SCM_PRETEND_VERSION" > brewman/_version.py
COPY --from=builder /frontend/browser /app/frontend
# Sync the project
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=brewman/uv.lock,target=uv.lock \
--mount=type=bind,source=brewman/pyproject.toml,target=pyproject.toml \
uv sync --locked --no-editable
EXPOSE 80
+19 -4
View File
@@ -1,13 +1,14 @@
.PHONY: build-production
build-production: ## Build the production container image. Usage: make build-production TAG=15.4.0
@test -n "$(TAG)" || { echo "Usage: make build-production TAG=15.4.0" >&2; exit 1; }
@echo "Building image..."
@podman manifest rm registry.tanshu.com/brewman:latest 2>/dev/null || true
@podman build \
--platform linux/amd64,linux/arm64 \
--manifest registry.tanshu.com/brewman:latest \
--pull \
--build-arg SETUPTOOLS_SCM_PRETEND_VERSION_FOR_BREWMAN=$(TAG) \
git@git.tanshu.com:tanshu/brewman.git#v$(TAG)
--build-arg SETUPTOOLS_SCM_PRETEND_VERSION=$(TAG) \
https://git.tanshu.com/tanshu/brewman.git#v$(TAG)
@echo "Pushing manifests..."
@podman manifest push --all registry.tanshu.com/brewman:latest docker://registry.tanshu.com/brewman:latest
@@ -15,11 +16,25 @@ build-production: ## Build the production container image. Usage: make build-pro
.PHONY: build-check
build-check: ## Multi-arch build without push (compile check). Usage: make build-check TAG=15.4.0
@test -n "$(TAG)" || { echo "Usage: make build-check TAG=15.4.0" >&2; exit 1; }
@echo "Building image..."
@podman manifest rm brewman:test 2>/dev/null || true
@podman build \
--platform linux/amd64,linux/arm64 \
--manifest brewman:test \
--pull \
--build-arg SETUPTOOLS_SCM_PRETEND_VERSION_FOR_BREWMAN=$(TAG) \
git@git.tanshu.com:tanshu/brewman.git#v$(TAG)
--build-arg SETUPTOOLS_SCM_PRETEND_VERSION=$(TAG) \
https://git.tanshu.com/tanshu/brewman.git#v$(TAG)
.PHONY: build-check-local
# Defaults the version when built without a tag; an explicit TAG still wins.
build-check-local: TAG = 0.0.0
build-check-local: ## Single-arch build without push (compile check). Usage: make build-check-local [TAG=15.4.0]
@echo "Building image..."
@podman manifest rm brewman:test 2>/dev/null || true
@podman build \
--platform linux/amd64 \
--manifest brewman:test \
--no-cache \
--build-arg SETUPTOOLS_SCM_PRETEND_VERSION=$(TAG) \
.