Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b691a577b | ||
|
|
aeee758718 | ||
|
|
3dfb0a2b2f | ||
|
|
7813ffbc66 |
+17
@@ -69,6 +69,14 @@ WORKDIR /app/
|
||||
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
# 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
|
||||
@@ -78,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
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
.PHONY: build-production
|
||||
build-production: ## Build the production container image. Usage: make build-production TAG=15.4.0
|
||||
@echo "Cloning repository..."
|
||||
@rm -rf .tmp-brewman
|
||||
@git clone --depth 1 $(if $(TAG),--branch v$(TAG)) git@git.tanshu.com:tanshu/brewman.git .tmp-brewman
|
||||
|
||||
@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 \
|
||||
.tmp-brewman || (rm -rf .tmp-brewman && exit 1)
|
||||
@rm -rf .tmp-brewman
|
||||
--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
|
||||
@@ -19,15 +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
|
||||
@echo "Cloning repository..."
|
||||
@rm -rf .tmp-brewman
|
||||
@git clone --depth 1 $(if $(TAG),--branch v$(TAG)) git@git.tanshu.com:tanshu/brewman.git .tmp-brewman
|
||||
|
||||
@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 \
|
||||
.tmp-brewman || (rm -rf .tmp-brewman && exit 1)
|
||||
@rm -rf .tmp-brewman
|
||||
--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) \
|
||||
.
|
||||
|
||||
Reference in New Issue
Block a user