Compare commits

..
7 Commits
Author SHA1 Message Date
tanshu 80addc5b20 Not cloning remote. using the right commit from the local git. 2026-09-18 02:40:45 +00:00
tanshu 68ccc25652 Trying to improve dockerfile cacheing 2026-09-18 02:37:11 +00:00
tanshu c32db91535 Fix: Product Ledger autocomplete not working. 2026-09-17 10:58:17 +00:00
tanshu 79cdf83c9e Healthcheck in OCI
session date format
2026-09-16 06:53:38 +00:00
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
8 changed files with 73 additions and 29 deletions
+8 -1
View File
@@ -1,3 +1,7 @@
# Ignore Git metadata
.git
.gitignore
# IDEs & System Files
.idea/
.DS_Store
@@ -51,4 +55,7 @@ yarn-error.log*
# Ignore Pyright-generated stubs
*.pyi
typings/
typings/
# AI Coding agents temp files
.scratch/
+1 -1
View File
@@ -4,7 +4,7 @@
"tasks": [
{
"type": "npm",
"script": "start -- --port 4200",
"script": "start",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/overlord"
+20 -6
View File
@@ -5,7 +5,7 @@
# builds (podman builds all --platform targets concurrently).
# Declare the automatic build arguments
ARG BUILDPLATFORM
FROM --platform=$BUILDPLATFORM node:lts-trixie-slim AS base
FROM --platform=$BUILDPLATFORM docker.io/library/node:lts-trixie-slim AS base
# Install dependencies only when needed
FROM base AS deps
@@ -36,7 +36,7 @@ RUN \
else echo "Lockfile not found." && exit 1; \
fi
FROM python:3.14-slim AS runner
FROM docker.io/library/python:3.14-slim AS runner
LABEL maintainer="Amritanshu <docker@tanshu.com>"
RUN apt-get update \
@@ -69,10 +69,6 @@ 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
# Install dependencies
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
RUN --mount=type=cache,target=/root/.cache/uv \
@@ -81,11 +77,29 @@ RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-install-project
COPY /brewman ./
# Pass the version from the Makefile. The build context has no usable .git
# (git archive stream / shallow clone lacks git metadata), 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
# 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
+21 -6
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 \
@git archive --format=tar "v$(TAG)" | 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) \
-
@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 \
@git archive --format=tar "v$(TAG)" | 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) \
-
.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) \
.
+6 -3
View File
@@ -32,6 +32,9 @@
env_file: "/var/lib/{{ host_directory }}/.env"
networks:
- name: "brewman_{{ instance }}_net"
# volumes:
# - "/var/lib/{{ host_directory }}/frontend:/frontend"
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost/health || kill -s 15 1"]
interval: 30s
timeout: 5s
start_period: 30s
retries: 3
+12 -3
View File
@@ -14,7 +14,10 @@ def report_start_date(request: Request, s: str | date | None = None) -> date:
return d
if "start" not in session:
session["start"] = get_first_day(date.today()).isoformat()
return date.fromisoformat(session["start"])
try:
return date.fromisoformat(session["start"])
except ValueError:
return get_first_day(date.today())
def report_finish_date(request: Request, f: str | date | None = None) -> date:
@@ -28,7 +31,10 @@ def report_finish_date(request: Request, f: str | date | None = None) -> date:
return d
if "finish" not in session:
session["finish"] = get_last_day(date.today()).isoformat()
return date.fromisoformat(session["finish"])
try:
return date.fromisoformat(session["finish"])
except ValueError:
return get_last_day(date.today())
def report_date(request: Request, d: str | date | None = None) -> date:
@@ -42,7 +48,10 @@ def report_date(request: Request, d: str | date | None = None) -> date:
return parsed_date
if "date" not in session:
session["date"] = get_last_day(date.today()).isoformat()
return date.fromisoformat(session["date"])
try:
return date.fromisoformat(session["date"])
except ValueError:
return get_last_day(date.today())
def get_first_day(dt: date, d_years: int = 0, d_months: int = 0) -> date:
@@ -34,7 +34,7 @@
autocomplete="off"
/>
<mat-autocomplete #auto="matAutocomplete" autoActiveFirstOption [displayWith]="displayFn">
@for (account of accounts(); track account) {
@for (account of accounts(); track account.id) {
<mat-option [value]="account">{{ account.name }}</mat-option>
}
</mat-autocomplete>
@@ -26,20 +26,16 @@
<div class="row-container">
<mat-form-field class="flex-auto basis-4-5">
<mat-label>Product</mat-label>
<input
type="text"
matInput
#productElement
[matAutocomplete]="auto"
[formField]="form.product"
autocomplete="off"
/>
<input type="text" matInput [matAutocomplete]="auto" [formField]="form.product" autocomplete="off" />
<mat-autocomplete
#auto="matAutocomplete"
autoActiveFirstOption
[displayWith]="displayFn"
(optionSelected)="selected($event)"
>
@for (product of products(); track product.id) {
<mat-option [value]="product">{{ product.name }}</mat-option>
}
</mat-autocomplete>
</mat-form-field>
<button mat-raised-button type="submit" class="flex-auto basis-1-5" color="primary">Show</button>