From e58d679e67f7fe6cde741aebe01bf69f10acfac8 Mon Sep 17 00:00:00 2001 From: jordan Date: Fri, 6 Feb 2026 23:35:02 -0700 Subject: [PATCH] fix: add go mod download to component Dockerfiles Empty go.sum files were causing Docker builds to fail because Go couldn't verify dependencies. Added go mod download steps for both pkg and component directories before building. Co-Authored-By: Claude Opus 4.5 --- .../templates/templates/components/service/Dockerfile.tmpl | 4 ++++ .../templates/templates/components/worker/Dockerfile.tmpl | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/internal/adapter/templates/templates/components/service/Dockerfile.tmpl b/internal/adapter/templates/templates/components/service/Dockerfile.tmpl index 1653ac8..cb12421 100644 --- a/internal/adapter/templates/templates/components/service/Dockerfile.tmpl +++ b/internal/adapter/templates/templates/components/service/Dockerfile.tmpl @@ -14,6 +14,10 @@ WORKDIR /app COPY pkg/ ./pkg/ COPY services/{{COMPONENT_NAME}}/ ./services/{{COMPONENT_NAME}}/ +# Download dependencies (populates go.sum if empty) +RUN cd pkg && go mod download +RUN cd services/{{COMPONENT_NAME}} && go mod download + # Build from the service directory (uses replace directive for ../pkg) RUN cd services/{{COMPONENT_NAME}} && CGO_ENABLED=0 go build -o /{{COMPONENT_NAME}} ./cmd/server diff --git a/internal/adapter/templates/templates/components/worker/Dockerfile.tmpl b/internal/adapter/templates/templates/components/worker/Dockerfile.tmpl index b6094df..be5c530 100644 --- a/internal/adapter/templates/templates/components/worker/Dockerfile.tmpl +++ b/internal/adapter/templates/templates/components/worker/Dockerfile.tmpl @@ -14,6 +14,10 @@ WORKDIR /app COPY pkg/ ./pkg/ COPY workers/{{COMPONENT_NAME}}/ ./workers/{{COMPONENT_NAME}}/ +# Download dependencies (populates go.sum if empty) +RUN cd pkg && go mod download +RUN cd workers/{{COMPONENT_NAME}} && go mod download + # Build from the worker directory (uses replace directive for ../pkg) RUN cd workers/{{COMPONENT_NAME}} && CGO_ENABLED=0 go build -o /{{COMPONENT_NAME}} ./cmd/worker