fix: include adapter packages in container builds
Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
1 parent
e270810f33
commit
88564b340a
4 files changed
+17
No files matched your search
@@ -3,6 +3,8 @@
|
|||||||
!go.sum
|
!go.sum
|
||||||
!cmd/
|
!cmd/
|
||||||
!cmd/**
|
!cmd/**
|
||||||
|
!internal/
|
||||||
|
!internal/**
|
||||||
!Dockerfile
|
!Dockerfile
|
||||||
!autotune-entrypoint.sh
|
!autotune-entrypoint.sh
|
||||||
!Dockerfile.target
|
!Dockerfile.target
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ ENV CGO_ENABLED=0 GOTOOLCHAIN=local
|
|||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY cmd/ ./cmd/
|
COPY cmd/ ./cmd/
|
||||||
|
COPY internal/ ./internal/
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build go build -trimpath -o /out/zapret-autotune ./cmd/zapret-autotune
|
RUN --mount=type=cache,target=/root/.cache/go-build go build -trimpath -o /out/zapret-autotune ./cmd/zapret-autotune
|
||||||
|
|
||||||
FROM vernette/ss-zapret2@sha256:ba158180f27cd71a291ee521c291490374fd3fcf2f81eb1434ddfb19d35de45b
|
FROM vernette/ss-zapret2@sha256:ba158180f27cd71a291ee521c291490374fd3fcf2f81eb1434ddfb19d35de45b
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ ENV CGO_ENABLED=0 GOTOOLCHAIN=local
|
|||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY cmd/ ./cmd/
|
COPY cmd/ ./cmd/
|
||||||
|
COPY internal/ ./internal/
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build go build -trimpath -o /out/zapret-autotune ./cmd/zapret-autotune
|
RUN --mount=type=cache,target=/root/.cache/go-build go build -trimpath -o /out/zapret-autotune ./cmd/zapret-autotune
|
||||||
|
|
||||||
FROM vernette/ss-zapret2@sha256:ba158180f27cd71a291ee521c291490374fd3fcf2f81eb1434ddfb19d35de45b
|
FROM vernette/ss-zapret2@sha256:ba158180f27cd71a291ee521c291490374fd3fcf2f81eb1434ddfb19d35de45b
|
||||||
|
|||||||
@@ -4,6 +4,19 @@ from pathlib import Path
|
|||||||
|
|
||||||
|
|
||||||
directory = Path(__file__).resolve().parent
|
directory = Path(__file__).resolve().parent
|
||||||
|
root = directory.parents[1]
|
||||||
|
# ponytail: guard the current literal COPY and deny-all/allowlist ignore shape;
|
||||||
|
# use a Dockerfile/ignore parser if these become general patterns or multi-module.
|
||||||
|
ignore = [line for line in (root / ".dockerignore").read_text().splitlines()
|
||||||
|
if line and not line.startswith("#")]
|
||||||
|
assert ignore[0] == "*" and all(line.startswith("!") for line in ignore[1:])
|
||||||
|
package_roots = {path.relative_to(root).parts[0] for path in root.rglob("*.go")}
|
||||||
|
for name in ("Dockerfile", "Dockerfile.target"):
|
||||||
|
builder = (root / name).read_text().split("\nFROM ", 1)[0]
|
||||||
|
before_build = builder[:builder.index("go build")]
|
||||||
|
for package in package_roots:
|
||||||
|
assert f"COPY {package}/ ./{package}/\n" in before_build, (name, package)
|
||||||
|
assert f"!{package}/" in ignore and f"!{package}/**" in ignore, package
|
||||||
compose = (directory / "compose.yaml").read_text()
|
compose = (directory / "compose.yaml").read_text()
|
||||||
entrypoint = (directory.parents[1] / "managed-target-entrypoint.sh").read_text()
|
entrypoint = (directory.parents[1] / "managed-target-entrypoint.sh").read_text()
|
||||||
readme = (directory / "README.md").read_text()
|
readme = (directory / "README.md").read_text()
|
||||||
|
|||||||
Reference in new issue
Block a user