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 <noreply@anthropic.com>
This commit is contained in:
jordan 2026-02-06 23:35:02 -07:00
parent 5d86bb7c57
commit e58d679e67
2 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,10 @@ WORKDIR /app
COPY pkg/ ./pkg/ COPY pkg/ ./pkg/
COPY services/{{COMPONENT_NAME}}/ ./services/{{COMPONENT_NAME}}/ 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) # 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 RUN cd services/{{COMPONENT_NAME}} && CGO_ENABLED=0 go build -o /{{COMPONENT_NAME}} ./cmd/server

View File

@ -14,6 +14,10 @@ WORKDIR /app
COPY pkg/ ./pkg/ COPY pkg/ ./pkg/
COPY workers/{{COMPONENT_NAME}}/ ./workers/{{COMPONENT_NAME}}/ 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) # 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 RUN cd workers/{{COMPONENT_NAME}} && CGO_ENABLED=0 go build -o /{{COMPONENT_NAME}} ./cmd/worker