New cmd/invoiceintake (orca-infra #121, Collectives ERP/08). It reads the mails of ERPNext's Email Account "Eingangsrechnungen" through the REST API (no IMAP of its own; Strato forwards the originals to DUO) and, per mail: - e-invoice (XML first, then PDF): E Invoice Import draft, eu_einvoice reads and validates it; the person maps and creates the Purchase Invoice - other PDF: draft Purchase Invoice for the supplier matched by sender address or domain, one placeholder line, the original attached again - no PDF/XML, unknown sender, or a refused draft: a ToDo on the mail It never submits, changes or deletes anything and keeps no state: done mails are read back from ERPNext (intake_communication, unique; ToDo reference). A cancelled ToDo asks for another try. Dry run with -once -dry-run; logs carry document names and counts, no senders or subjects. erpsetup gains the two marker fields, the placeholder item EINGANGSRECHNUNG (unit Stück, group Eingangsrechnungen) and its expense account SKR04 6300. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
1.6 KiB
Docker
33 lines
1.6 KiB
Docker
# Multi-stage build for tenant-registry.
|
|
# Produces two binaries:
|
|
# /tenant-registry — long-running API server
|
|
# /migrate — one-shot schema migrator (Orca init container in prod)
|
|
# /erpmock — ERPNext stand-in for staging (decision 18; cmd/erpmock)
|
|
|
|
FROM golang:1.26-alpine AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
# Build version and commit for GET /version (CI passes both; portal#64).
|
|
ARG VERSION=dev
|
|
ARG COMMIT=
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X git.breakpilot.com/platform/tenant-registry/internal/buildinfo.Version=${VERSION} -X git.breakpilot.com/platform/tenant-registry/internal/buildinfo.Commit=${COMMIT}" -o /out/tenant-registry ./cmd/server && \
|
|
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/migrate ./cmd/migrate && \
|
|
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/erpmock ./cmd/erpmock && \
|
|
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/erpsetup ./cmd/erpsetup && \
|
|
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/invoiceintake ./cmd/invoiceintake
|
|
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
WORKDIR /
|
|
COPY --from=build /out/tenant-registry /tenant-registry
|
|
COPY --from=build /out/migrate /migrate
|
|
COPY --from=build /out/erpmock /erpmock
|
|
COPY --from=build /out/erpsetup /erpsetup
|
|
COPY --from=build /out/invoiceintake /invoiceintake
|
|
USER nonroot:nonroot
|
|
EXPOSE 8090
|
|
# CMD (not ENTRYPOINT) so orca's `cmd` can select /erpmock, /migrate or /invoiceintake in the
|
|
# same image. The server applies migrations itself with MIGRATE_ON_START=true.
|
|
CMD ["/tenant-registry"]
|